Apache Official Website
yum install httpd\* -yiptables -I INPUT 1 -p tcp --dport 80 -j ACCEPTservice iptables save
1 vim/etc/httpd/conf/httpd. conf2 3 ServerTokens OS // display version 4 ServerRoot "/etc/httpd" // default path 5 PidFile run/httpd. pid // process ID6 Timeout 120 // connection Timeout 7 KeepAlive Off // whether to remain active (three-way handshakes are not required when multiple files are transmitted) 8 MaxKeepAliveRequests 100 // The maximum number of files that are kept in the connection. 9. KeepAliveTimeout 15 // the maximum duration of the connection is 15 seconds.
1 <IfModule prefork. c> 2 StartServers 8 // how many idle processes are started when the server is started 3 MinSpareServers 5 // at least an unprecedented process, at any time, ensure that at least five idle processes accept user requests. 4 MaxSpareServers 20 // The maximum number of idle processes is retained. A maximum of 20 idle processes can be retained, 5 ServerLimit 256 is a waste of resources. // The maximum number of request Connections cannot exceed. This is the upper limit, to increase the value, you must first disable the service before calling 6 MaxClients 256 // The maximum number of requests that can be run to connect to 7 MaxRequestsPerChild 4000 // The maximum number of requests that each process can respond, if this value is reached, the system will be killed. Restart PROCESS 8 </IfModule>
1 Listen 80 // The default listening port number 2 Include conf. d /*. conf // set conf. d directory suffix is. conf files are loaded in 3 User apache // set the Default User 4 Group apache // set the default Group 5 ServerAdmin root @ localhost // administrator mailbox 6 ServerName www.example.com: 80 // set the site domain name 7 DocumentRoot "/var/www/html" // set the website directory to the index.html File
1 <Directory "/var/www/html"> 2 Options Indexes FollowSymLinks3 AllowOverride None4 Order allow. The default value behind deny // is 5 Allow from all. // conflict occurs, the default value is 6 deny from all 7. </Directory>
1 Options // define the access attribute 2 None when all webpage files in the <Directory "/var/www/html"> Directory are accessible. // no Options are supported. 3 all // enable all option 4 Indexes // allow index directories. When no index.html file exists in the index directory, all files in the directory are listed. 5 FollowSymLinks // The source file to which the symbolic link is allowed, that is, soft connection 6 ExecCGI // run the cgi script
1 <IfModule mod_userdir.c> // if this module is installed, whether or not the user can create a webpage in the home directory 2 UserDir disable // enable the function to prohibit the user from creating the Home Directory 3 UserDir public_html // enable description: run user create in home directory 4. Note: Create public_html under/home/user1/. If you cannot view the Boolean value httpd_enable_homedirs
1 DirectoryIndex index.html. var // default access file name and Sequence 2 3 <Directory "/var/www/jiami"> 4 AllowOverride AuthConfig // encrypted access 5 </Directory> 6 7 use user name and password authentication login 8 ① enter the folder to be verified to create. htaccess file 9 vim. htaccess10 11 AuthName xxxx // defines the name of the protected domain 12 AuthName Basic // defines the authentication method 13 AuthName/var/www/html /. htpasswd // specify the location of the authentication Password File 14 Require user xxx // authorize the specified user 15 and create it under the change path. htpasswd authentication Password File 16 htpasswd-cm. htpasswd username enter password 17 18 Alias/icons/"/var/www/icons/" // Alias settings
1 VM settings: 2 3 based on host name 4 5 NameVirtualHost *: 80 6 <VirtualHost *: 80> 7 DocumentRoot/var/www/html // when no double quotation marks are added, the absolute path is added, and the relative path 8 ServerName www.sangmu.com // domain name 9 <location> 10 order allow, deny11 deny from all12 allow from 192.168.10.1413 </location> 14 </VirtualHost> 15 16 <VirtualHost *: 80> 17 DocumentRoot/var/www/html 18 ServerName www.sangmu1.com 19 </VirtualHost>
1 Based on IP 2 NameVirtualHost *: 80 this need to be commented out 3 <VirtualHost 192.168.10.14: 80> 4 DocumentRoot/var/www/html 5 ServerName www.sangmu.com 6 </VirtualHost> 7 8 <VirtualHost 192.168.10.141: 80> 9 DocumentRoot/var/www/html 10 ServerName www.sangmu.com 11 </VirtualHost> 12 13 add ip address 14 ① add ip Address: ip addr add 192.168.10.141/24 dev eth0 label eth0: 115 configuration file cp-p ifcfg-eth0 ifcfg-eth0: 116 ③ modify the configuration file and restart the network card
1 add listening port based on Port 2 3: listen 8080 and configure firewall 4 Add namevirtualhost *: 8080 5 6 <VirtualHost *: 80> 7 DocumentRoot/var/www/html 8 ServerName www.sangmu.com 9 </VirtualHost> 10 11 <VirtualHost *: 8080> 12 DocumentRoot/var/www/html 13 ServerName www.sangmu.com 14 </VirtualHost>