在阿狸云ECS上用端口配置Apache虚拟主机,没效果……

公司目前只有一个域名通过备案,网站已经上线,我想为开发配个虚拟主机,所以用端口来区分。
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

请问哪里配错了呢?谢谢大家!

阅读 2.2k
1 个回答

在阿里云后台的安全组中添加你的端口配置

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题