未找到 未在此服务器上找到请求的 URL

未找到 未在此服务器上找到请求的 URL

我的虚拟主机如下所示the-square.local.conf

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port t>
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin admin@the_square.com
ServerAlias the-square.local
ServerName the-square.local
DocumentRoot /var/www/html/the_square/public

<Directory /var/www/html/the_square/public>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/the-square.local-error.log
CustomLog ${APACHE_LOG_DIR}/the-square.local-access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

我已经启用该网站sudo a2ensite the-square.local

而且我也在/etc/hosts下面添加了127.0.0.6 the_square.local

我已经重新启动了 apache 2 systemctl reload apache2

我也这么做了sudo chmod -R 755,并且777参与了这个项目。

我的其他虚拟主机运行都没有问题,但这次我找不到问题所在。

谢谢你!

  • 编辑:我将项目名称更改为thesquare,并且在所有配置中也进行了此更改,但仍然出现相同的错误...

答案1

_关于在域名中使用下划线的可能性的说明从理论角度来看有点含糊。但在现代实践中肯定不鼓励这样做。带有下划线的域名很可能既无法解析,又不被现代系统允许。主机名也是如此,DocumentRoot在某些情况下甚至 Apache 也是如此。

例如,请参阅此帖子:

(域名)子域名中间可以有下划线“_”吗?

这篇文章与 Apache 相关DocumentRoot

错误请求 您的浏览器发送了此服务器无法理解的请求

值得注意的是,顶级域名.local.localdomain可能并非所有 DNS 循环器都完全支持,在这种情况下,可能会使用TLD代替。

相关内容