公司目前只有一个域名通过备案,网站已经上线,我想为开发配个虚拟主机,所以用端口来区分。
Cent7系统,httpd-vhost.conf 里的配置如下(假设公司域名 my.com):
这是我配得,用8081,防火墙已开放,且netstat显示httpd已监听该端口
<VirtualHost *:8081>
DocumentRoot "/home/my/www"
ServerName www.my.com
ServerAlias my.com
ErrorLog "/home/my/logs/error_log"
CustomLog "/home/my/logs/access_log" combined
<Directory "/home/my/www">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>
下面是原来配好的,域名也是 my.com
<VirtualHost *:80>
DocumentRoot "/home/ecs/www"
ServerName www.my.com
</VirtualHost>
现在问题是,我在浏览器地址栏里键入
www.my.com:8081/index.php
结果显示的还是
/home/ecs/www/index.php
为什么不是
/home/my/www/index.php
请问哪里配错了呢?谢谢大家!
在阿里云后台的安全组中添加你的端口配置