端口无法连接,记得查看是否开启了防火墙或者查看云服务器入端口是否开启!!!!
window下 安装了wampmanager的找到如下目录
方法一
F:\wamp\bin\apache\apache2.4.37\conf\extra
打开 httpd-vhosts.conf 文件
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
添加如下:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:81>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www2"
<Directory "${INSTALL_DIR}/www2/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
方法二
打开F:\wamp\bin\apache\apache2.4.37\conf目录先的 httpd.conf
Listen 80 后面添加 Listen 81
Listen 80
Listen 81
然后在httpd.conf末尾添加
<VirtualHost *:81>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www2"
<Directory "${INSTALL_DIR}/www2/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
重启apache 即可实现不同端口管理不同项目(
端口无法连接,记得查看是否开启了防火墙或者查看云服务器入端口是否开启!!!!)
centos系统同理由
端口无法连接,记得查看是否开启了防火墙或者查看云服务器入端口是否开启!!!!
方法一:在目录/etc/httpd/conf.d目录下新建 VirtualHost.conf文件(名字随便取,但后缀一定要是.conf)
# Virtual Hosts
#
<VirtualHost *:81>
ServerName localhost
ServerAlias localhost
DocumentRoot "/var/www2/html"
<Directory "/var/www2/html">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
~
保存,重启apache服务器
方法二:修改 /etc/httpd/conf/httpd.conf,步骤和内容如上windows方法二
需要注意的是:
DocumentRoot “${INSTALL_DIR}/www2” 改为 DocumentRoot “/var/www2/html” 或者你的文件目录
<Directory “${INSTALL_DIR}/www2/”> 改为<Directory “/var/www2/html”> 或者你的文件目录