简体   繁体   English

没有www的服务器返回404

[英]Server without www returns 404

I'm running Apache2 on Debian Jessie, when i try to enter my site without www. 我在Debian Jessie上运行Apache2,当我尝试进入没有www的网站时。 it returns a 404 page. 它返回404页面。

What i have in apache config: 我在apache配置中有什么:

<VirtualHost *:80>
   DocumentRoot "/var/www/sites/example.com"
   ServerName www.example.com
   ServerAlias example.com
</VirtualHost>

<VirtualHost *:443>
    SSLEngine On
    DocumentRoot "/var/www/sites/example.com"
    ServerName www.example.com
    ServerAlias example.com
    SSLCertificateFile /etc/chain.pem
    SSLCertificateKeyFile /etc/key.pem
</VirtualHost>`

Now , there are no other definitions in "sites-enabled" that mentions the site 现在,“启用站点”中没有其他定义提及该站点

1- Both example.com and www.example.com have the same ip ( Not a DNS problem ) 1- example.com和www.example.com都有相同的ip(不是DNS问题)

2- There are no extra configurations in "sites-available" 2-“站点可用”中没有额外配置

3- https://example.com works fine but http://example.com returns a 404 3- https://example.com工作正常,但http://example.com返回404

有一个<VirtualHost *:80>没有ServerName ,而apache使用默认服务器主机名是example.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM