Apache configures multiple listening ports and different web directories
- 2020-06-15 11:01:10
- OfStack
Apache configures multiple listening ports and different web directories
1: Add multiple ports
Listen 80
Listen 81
Listen 82
2: Set the virtual host directory
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/phpStudy/WWW/"
</VirtualHost>
NameVirtualHost *:81
<VirtualHost *:81>
ServerName localhost:81
DocumentRoot "D:\phpStudy\WWW\4jcms"
</VirtualHost>
The configuration information used by phpstudy is:
DocumentRoot "D:\phpStudy\WWW\4jcms"
<Directory localhost/>
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Can be changed to red font configuration
3: Restart Apache
Note: Port 80 is best directed to the phpstudy root directory www, anything else is optional
If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!