我正在尝试设置 Apache2 服务器。安装和配置似乎进行得很顺利,但是当我尝试访问我的自定义 Web URL 时,出现“无法访问此站点”错误。我已尝试通过此答案设置配置文件 -尝试在浏览器中访问 Apache 2.4.7 Web 服务器时出现 Forbidden 403 错误。
我的主机文件如下所示:
127.0.0.1 localhost
127.0.0.1 justtestingthis
127.0.1.1 Hacker
# The following lines are desirable for IPv6 capable hosts
...
Run Code Online (Sandbox Code Playgroud)
我的apache2/sites-available/http.justtestingthis.conf文件看起来像这样:
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName justtestingthis.com
ServerAlias www.justtestingthis.com
DocumentRoot /home/donatas/Desktop/Projects/justtestingthis/dist/src
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/donatas/Desktop/Projects/justtestingthis/dist/src>
# Allow .htaccess
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我还在apache2/sites-enabled使用sudo a2ensite http.justtestingthis.conf.
当我通过输入http://localhost访问该网站时,我的网站被成功找到,但是当我尝试通过 justtestingthis.com 或 www.justtestingthis.com 访问它时,我得到“这个网站无法到达错误”... …