Wamp/Mamp 多站点多端口配置

概念:

  • Wamp 是 Windows Apache Mysql PHP 集成安装环境,适用于 Windows 系统;
  • Mamp 是 Mac Apache Mysql PHP 集成安装环境,适用于 Mac OS 系统;

1. 配置 httpd.conf

  • 监听多个端口:

    #Listen 12.34.56.78:80
    Listen 80
    Listen 8080
    Listen 8081
    Listen 8082
    Listen 8083
    Listen 8084
    Listen 8085
  • 开启虚拟站点

# Virtual hosts
# Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

修改为

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

2. 配置 httpd-vhosts.conf

在页尾添加

<VirtualHost *:8081>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "/Volumes/Item/Site1/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "/Volumes/Item/Site1/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:8082>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "/Volumes/Item/Site2/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "/Volumes/Item/Site2/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
发表评论
* 昵称
* Email
* 网址
* 评论