Apache is the world's No. 1 Web server software. It can run on almost all widely used computer platforms. Because of its wide use of cross-platform and security, it is one of the most popular Web server software. Apache is also translated as Apache, a tribe of North American Indians called Apache in the southwestern United States. It is also the name of a foundation, an armed helicopter, and so on. More than 75% of web servers in the world are using apache, which is more flexible, safer, and more reliable than Microsoft's IIS. Apache is the world's top Web server software. It can run on almost all widely used computer platforms. Because of its wide use of cross-platform and security, it is one of the most popular Web server software. Apache is also translated as Apache, a tribe of North American Indians called Apache in the southwestern United States. It is also the name of a foundation, an armed helicopter, and so on. More than 75% of web servers in the world are using apache. Compared with Microsoft's IIS, apache is more flexible, secure, and reliable, and controllable. Next we will introduce the most basic apache server setup process. In the apache Server File, httpd. conf is the core configuration file, which includes the following content:
Httpd. conf path:/etc/httpd/conf/httpd. conf
ServerRoot: Root directory of the apache server. The default value is/etc/httpd.
Timeout: The timeout time for the network connection between the browser and the web server. The default value is 120 seconds.
KeepAlive: Whether the server remains connected. The default value is off.
MaxKeepAliveRequests: Maximum number of requests for server persistence. The default value is 100.
KeepAliveTimeout: Timeout time for connection persistence. The default value is 15 seconds.
StartServers: Number of started services (processes). The default value is 8 (101 rows)
MinSpareServers: Minimum number of idle services. The default value is 5.
MaxSpareServers: Maximum number of idle services. The default value is 20.
ServerLimit: Maximum number of service processes, 256 by default
MaxClients: Maximum user concurrency. The default value is 256.
MaxRequestsPerChild: Maximum number of pages that can be opened. The default value is 4000.
Listen: Server port number. The default value is 80 (134 rows)
User/Group: Server users and groups with low permissions. apache (231 rows) is used by default)
ServerAdmin: The email address of the server administrator. The default address is root @ localhost (line 1)
ServerName: Server host name. The default value is www.example.com: 80 (row 265)
DocumentRoot: Home page Directory. The default value is/var/www/html (281 rows)
Options Indexes FolowSymLinksThe function is to find the link to the homepage index (row 320)
Order allow, denyAllow first and then reject (332 rows)
Allow from allAll
UserDir disable: Whether to enable the user homepage function. The default value is "reject". You can use # To comment out the function (line 1)
UserDirpublic_html: If you enable the user homepage function, you need to remove the comments (362 rows)DirectoryIndexindex.htmlindex.html. varThe name of the Main Page, whose name is index.html (Row 3)
By default nothing is configured, directly start the httpd service, in the windows System Browser input http: // 192.168.10.1 or http://www.hujw.com (need to do DNS resolution ), the following RHEL system test page is displayed.If you need to run your website on the server, you can put your webpage files under the home directory.
Service httpd start
Next let's take a look at the configuration of the virtual host in Apache. Virtual Hosts allocate a certain amount of disk space on network servers for users to place sites and application components, and provide necessary site functions, data storage and transmission functions. The so-called virtual host, also known as "website space", is to divide a server running on the Internet into multiple "virtual" servers, each VM has an independent domain name and a complete Internet server (supporting WWW, FTP, E-mail, and so on. That is, the host that can run multiple website instances on the same server. This is widely used in IDC operators.
To set up a VM, we must first ensure that the DNS server can resolve two domain names, for example, hujw.com and snow.com. Let's take a look at the settings on the DNS server.
Note: because the two domain names are in the same CIDR block, you cannot add reverse resolution for snow.com. Otherwise, an error will be reported when you start the service. Reverse resolution of snow.com will be described later. Create a forward resolution file and create snow.com. zone in the/var/named/chroot/var/named directory.
Because there is no reverse resolution, we cannot create reverse resolution files, but we can reverse parse the original hujw.com. rev reverse resolution file.
Restart DNS
Service named restart
Restart the httpd service
Service httpd restart
Verify the DNS resolution effect and you can find that it is successful.
Next, set the IP address of the VM and find line 972nd of httpd. conf. Configure the Domain Name of the VM.
Vi/etc/httpd/conf/httpd. conf
192.168.10.1 is the IP address of the VM,/var/www/html/is the home directory, followed by two different domain names and error logs.
Create a home page for the VM and go to/var/www/html to create two folders: hujw.com and snow.com.
Cd/var/www/html
Mkdir hujw.com snow.com
Cd hujw.com
Echo "Welcome to hujw's home."> index.html
Cd ..
Cd snow.com
Echo "Welcome to snow's home."> index.html
Index.html must be accessible to all users.
Ll.-d
Test in windows User Environment
VM set up successfully!