Apache configures virtual hosts and reports errors

After installing the apache service, edit the httpd-vhosts.conf virtual host configuration file. Generally speaking, this file is in the path of "/etc/httpd/conf/extra/httpd-vhosts.conf", but it seems that the latest Apache uses yum The installation does not have this file, but you can manually create it in the "/etc/httpd/conf.d/" directory. As long as the httpd.conf configuration file corresponds to a good path, the location can be changed.

Modify the Include item of httpd.conf to specify the virtual host configuration file path
Apache configures virtual hosts and reports errors

Edit the httpd-vhosts.conf virtual host configuration file

<VirtualHost *:80>
DocumentRoot "/var/www/html"
#Specify the site directory ServerName www.abc.com #Access domain name
ErrorLog logs/www.abc.com.error_log #Error log storage path
CustomLog logs/www. abc.com.access_log common #Access log storage path
</VirtualHost>

Then restart the service, but I get an error during the restart

[Thu May 03 13:46:14 2018] [warn] default VirtualHost overlap on port 80, the first has precedence
[Thu May 03 13:46:14 2018] [warn] default VirtualHost overlap on port 80, the first has precedence.
Apache configures virtual hosts and reports errors

This error means that it is not really applied to these virtual hosts. It needs to be modified in the httpd.conf configuration file. Just remove the comment in front of the NameVirtualHost item.
Apache configures virtual hosts and reports errors

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325207141&siteId=291194637