apache 本地多端口配置

如何在本地调试多项目,利用端口号区分

http://localhost:90/     90端口的时候访问的是D:\php

http://localhost:91/    91端口的时候访问的是D:\php2

http://localhost:92/    92端口的时候访问的是D:\php3

步骤一: 打开apache的httpd.conf文件,在Listen 90处另起一行输入Listen 91 监听91端口,如需其他端口需逐个添加:

Listen 90

Listen 91

Listen 92

 步骤二:在httpd.conf文件最后一行添加

<virtualhost localhost:91># 虚拟主机端口
    documentroot D:/php2  #网站目录绝对路径
    servername locahost:91 #对应监听的端口
</virtualhost>

#继续添加目录属性:
<Directory "D:/php2">
    Options Indexes FollowSymLinks
    AllowOverride All 
    Order allow,deny
    Allow from all
</Directory>

<virtualhost localhost:92># 虚拟主机端口
    documentroot D:/php3  #网站目录绝对路径
    servername locahost:92 #对应监听的端口
</virtualhost>

#继续添加目录属性:
<Directory "D:/php3">
    Options Indexes FollowSymLinks
    AllowOverride All 
    Order allow,deny
    Allow from all
</Directory>

完成后重启apache

 注意:::

有时wamp访问站点出现you don’t have permission to access / on this server

(Apache Server权限访问问题)

修改httpd.conf:
 
<Directory />
    AllowOverride none
    Require all denied
</Directory>

<Directory />
    AllowOverride none
   #Require all denied
</Directory>

猜你喜欢

转载自blog.csdn.net/hi1234560/article/details/125234197
今日推荐