2

我正在为我的网络服务器运行 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 内部的 页面但是对 Messagehttp://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 文件夹之外的站点?

4

1 回答 1

1

在查看 apache 日志和其他人的帮助后,我找到了自己问题的答案第一件事我将网站的 apache conf 文件更改为

<VirtualHost *:80>
        ServerAdmin admin@mytestsite.com
        ServerName mytestsite.com
        ServerName <ServerIpAddress>
        DocumentRoot /var/www
        <Directory /var/www/mytestsite.com/public_html**/>
                Options -Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我还对 /etc/hosts 文件进行了更改,以将站点包含为

<localhostIp>       localhost
<localhostIp>       ubuntu
<ServerIpAddress>   mytestsite.com mytestsite.com

进行更改后,我可以从服务器外部访问站点

于 2015-01-12T03:04:12.043 回答