【发布时间】:2015-03-06 15:36:36
【问题描述】:
我正在为我的网络服务器运行 Ubuntu (+LAMP) 堆栈。网络服务器的一切似乎都运行良好。例如我有 index.php 页面与
<?php
phpinfo();
?>
在 /var/www/html 内 & 也在 /var/www/mytestsite.com/ 下
从网络服务器内部,两个站点 @http://MyServerIPAddress/hello.php 和 http://MyServerIPAddress/mytestsite.com/hello.php 都在显示正确的 phpinfo。
当我从服务器外部测试时,我只能访问 /var/www/html 内的页面
http://MyServerIPAddress/hello.php
但是页面访问
http://MyServerIPAddress/mytestsite.com/hello.php
消息显示
Not Found
The requested URL /example.com was not found on this server.
Apache/2.4.7 (Ubuntu) Server at *MyServerIPAddress* Port 80.
这是我用于 apache 的 mytestsite.com.conf
<VirtualHost *:80>
ServerAdmin admin@mytestsite.com
ServerName mytestsite.com
ServerAlias www.mytestsite.com
DocumentRoot /var/www/mytestsite.com
</VirtualHost>
并且还将文件夹访问权限和所有者设置与 /var/www/html 和 /var/www/mytestsite.com 匹配
我需要什么额外的配置才能访问 /var/www/html 文件夹之外的网站?
【问题讨论】:
-
如果您尝试将 index.php 放在
/var/www/html/mytestsite.com/会怎样? -
也可以。只有当我创建一个与 /var/www/html 相同级别的新文件夹时,我才能让它工作。
标签: lamp ubuntu-14.04 apache2.4