1: In the httpd.conf, open the line
Include conf/extra/httpd-vhosts.conf
2: Into the conf/extra/, modify the httpd-vhosts.conf
The original file is like this
<virtualhost *:80>
ServerAdmin [email protected] (email)
DocumentRoot "/WEB/WWW1" (Publish directory)
ServerName www.luo.com (domain name)
Serveralias www.luo2.com (This can be configured with multiple domain names)
Errorlog "Logs/dummy-host.example.com-error_log" (log)
Customlog "Logs/dummy-host.example.com-access_log" Common (log)
</VirtualHost>
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/WEB/WWW2"
ServerName www.luo1.com
Errorlog "Logs/dummy-host2.example.com-error_log"
Customlog "Logs/dummy-host2.example.com-access_log" common
</VirtualHost>
After this configuration is still not open, show no permissions
At first glance there is no problem, but under apache-2.4.37 This configuration is complete, no access. Follow the prompts to view the directory and file permissions issues, no problem; View program error log and system log there is no obvious error; Calm down and think about it, there is no problem with the directory and file permissions, the rest is the Site Directory access permissions, So in the virtual host configuration file inside the virtual host configuration before adding such a paragraph:
<directory "Virtual Host Site Directory" >
Options Indexes FollowSymLinks includes execcgi
AllowOverride All
Require all granted
</Directory>
The configuration file is as follows
<directory "/web" >
Options Indexes FollowSymLinks includes execcgi
AllowOverride All
Require all granted
</Directory>
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/WEB/WWW1"
ServerName www.luo.com
Serveralias www.luo2.com
Errorlog "Logs/dummy-host.example.com-error_log"
Customlog "Logs/dummy-host.example.com-access_log" common
</VirtualHost>
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/WEB/WWW2"
ServerName www.luo1.com
Errorlog "Logs/dummy-host2.example.com-error_log"
Customlog "Logs/dummy-host2.example.com-access_log" common
</VirtualHost>
After the above modification, restart the Apache service, now can access the normal
This article is from the "Luojinsheng" blog, make sure to keep this source http://3774912.blog.51cto.com/3764912/1948908
apache2.4.27 Configuring a virtual Host