FreeBSDWeb server configuration

Source: Internet
Author: User
Tags nameserver nslookup nslookup command
& Nbsp; Web server (192.168.10.40) provides both Web services and DNS services. So here we need to install and configure Apache and Bind. Server Network Configuration # ee/etc/rc. conw.config_lnc0inet192.168.10.40netmask00000000255.0defaultrouter1900008

The Web server (192.168.10.40) provides both Web services and DNS services. So here we need to install and configure Apache and Bind.

Server network configuration
# Ee/etc/rc. conf
Ifconfig_lnc0 = "inet 192.168.10.40 netmask 255.255.255.0"
Defaultrouter = "192.168.10.10"
 
Hostname = "web. rd. bj"
# Ee/etc/hosts
192.168.10.40 web. rd. bj
 
After configuring the network environment, we will first configure the DNS server. Bind has been installed in the default Freebsd installation process. now we only need to modify the configuration file.
Now we want to virtualize a domain name: rd. bj as the root domain name of the entire test environment.
 
# Cd/etc/namedb/
# Ee named. conf
Add the listening IP address 192.168.10.40 to listen-on.
Listen-on {127.0.0.1; 192.168.10.40 ;};
Then, add:
Zone "rd. bj "{
Type master;
File "master/rd. bj ";
};
Zone "10.168.192.in-addr. arpa "{
Type master;
File "master/10.168.192.in-addr. arpa ";
};
 
Setting of positive resolution
# Eemaster/rd. bj
Join:
$ TTL 172800
@ In soa rd. bj. root. rd. bj .(
2005100301; Serial
172800; Refresh
900; Retry
3600000; Expire
3600); Minimum
In ns rd. bj.
In a 192.168.10.40
Web in a 192.168.10.40
Squid01 in a 192.168.10.30
Squid02 in a 192.168.10.31
Proxy in a 192.168.10.20
Www in a 192.168.10.20
 
@ Indicates the domain name rd. bj, and IN indicates the data type of the internet.
SOA is followed by rd. bj, indicating that this rd. bj machine is the primary nameserver in the rd. bj domain. Root. rd. bj indicates that the administrator's Email is a root@rd.bj.
Except for the first row, the content of each row is in the format of [name] [ttl] [class] [type] [data]. Descriptions of each field are as follows:
Name: the domain name or host name. If this parameter is not specified, the domain name is the same as the previous one.
Ttl: the time to live (time to live) of the data, that is, the time that the cache server retains in its cache. If this parameter is left blank, it indicates that the setting is the same as that in SOA.
Class: specifies the network type. this field should all use IN to represent the internet.
Type: Set the data type, such as MX, A, CNAME, PTR, and NS.
Data: the part of the actually set data.
Serial: In this version, the number modified this time must be larger than the previous number, that is, the number must be increased every time this file is modified, in this way, other servers will update the data. Generally, we add a few digits to the date. for example, 2004040301 indicates the first setting of January 1, April 3, 2004.
Refresh: The number is how long it takes for the secondary name server to compare and update the data with the primary name server.
Retry: if the comparison fails, it takes several seconds before querying the server with the primary name.
Expire: indicates that if the secondary name server cannot connect to the primary name server, the data cannot be compared for a long time. This field is calculated in seconds.
Minimum: indicates how long other cache servers can store your settings.
 
Reverse File settings
# Ee master/10.168.192.in-addr. arpa
Join:
$ TTL 172800
@ In soa rd. bj. root. rd. bj .(
2001080301; Serial
172800; Refresh
900; Retry
3600000; Expire
3600); Minimum
In ns rd. bj.
40 in ptr rd. bj.
40 in ptr web. rd. bj.
30 in ptr squid01.rd. bj.
31 in ptr squid02.rd. bj.
20 in ptr proxy. rd. bj
20 in ptr www. rd. bj
 
After the correct and reverse file are set, run the following command to generate a reverse file of localhost:
# Cd/etc/namedb
# Sh make-localhost
Finally, modify the/etc/resolv. conf file.
# Ee/etc/resolv. conf
Set:
Nameserver 127.0.0.1
In this way, the server can become the first DNS server in the domain.
 
Now we have configured our DNS server. start her !!!
#/Etc/rc. d/named start
We can use the following command to query information:
# Tail/var/log/messages
If no error message is displayed, run the nslookup command to verify the settings.
# Nslookup web. rd. bj
 
We have a situation to remind you that, as we have not configured the squid01, squid02, and proxy servers, we may test the situation here, so we can set up the other three servers and test them together (as long as there is no DNS error information in the messages file, here we will first assume that our configuration is correct), and then we will set the boot to start the DNS service.
# Ee/etc/rc. conf
Join:
Named_enable = "YES"
 
After work, go home and write it !!! Traffic congestion in Beijing
 
Okay. let's continue!
 
Now let's start to install the Apache server, first look for whereis
 
# Whereis apache22
Apache22:/usr/ports/www/apache22
Lets go, find her...
# Cd/usr/ports/www/apache22
# Make config # configure installation options
 
You can choose to install it based on your actual usage, because I have created an experiment environment and installed all the modules that can be installed. The purpose is to configure all modules in the future to see the effect, install them in advance for emergency purposes.
If you want to run Apache in worker mode, you need to modify the Makefile file.
# Ee Makefile
Set WITH_MPM? = Prefork # or worker, event, and itk should be changed:
WITH_MPM? = Worker # or worker, event, itk
# Make install clean
OK. wait patiently and tell a joke. let's take it easy!
One day, the teacher had a question in practice class to let everyone use C programming. The final result must be consistent with his answer.
The class had no solutions at the specified time and was nearly lunch, and the crowd was even more dizzy. Suddenly a classmate called a teacher, and he became a teacher.
The answer is the same as the answer. Let it go.
The crowd secretly thought that the person's level is average, and why is the current high level available. Let's look for the source code.
There is only one sentence "printf (" XXXXX ");"
Everyone else.
 
After a long wait, the installation is complete.
# Rehash
# Pkg_info | grep apache
The apache-worker-2.2.6_3 Version 2.2 of Apache web server with worker MPM.
# Apachectl-l
Compiled in modules:
Core. c
Worker. c
Http_core.c
Mod_so.c
Now we have made simple configuration for Apache and made more in-depth optimization for Apache. we will not discuss it here for the time being. after all our experimental environments have been set up, you can make adjustments based on your business needs.
# Cd/usr/local/etc/apache22
# Ee httpd. conf
Change the following parameters:
Listen 192.168.10.40: 80
ServerAdmin admin@rd.bj
ServerName web. rd. bj: 80
The rest will remain unchanged.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.