在子目录中找不到Ubuntu 404

时间:2018-09-24 13:45:50

标签: ubuntu ubuntu-14.04

我的网站在var / www / html文件夹上工作。

我在var / www / html / mynewsite上有另一个站点。

当我尝试像此服务器ip 1.2.3.4/mynewsite一样访问它

无法正常工作,并显示404未找到错误。

Apache配置

DocumentRoot“ / var / www / html / public /”选项FollowSymLinks MultiViews AllowOverride All #Order allow,deny要求全部授予

1 个答案:

答案 0 :(得分:1)

根据Apache官方documentation,最简单的解决方案是使用serverName配置字段。

Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/html/public"
    ServerName www.mainsite.com

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/www/html/mynewsite"
    ServerName www.mynewsite.com

</VirtualHost>

为了进行测试,您可以更改本地hosts以使www.mynewsite.comwww.mainsite.com重定向到1.2.3.4

上线时,您必须更改dns。

希望有帮助

相关问题