我的本地环境中有 Ubuntu 18.04、Apache、MySQL 和 PHP7.4,并且我已经在 Laravel 和 WordPress 中本地设置了各种项目。自从我开始使用 docker 以来,我已经一年多没有这样做了,所以我不确定我是否错过了一些明显的东西。当我尝试导航到我在本地设置的 WordPress 网站时,出现了此错误。
Unable to connect
Firefox can’t establish a connection to the server at
myproject.development.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
我在本地创建新项目时通常执行的步骤与此处的 DigitalOcean 指南类似。 https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
创建数据库并安装 PHP 扩展。启用配置文件。
<VirtualHost *:80>
ServerName myproject.development
ServerAlias www.myproject.development
DocumentRoot /home/myname/projects/myproject
<Directory "/home/darko/projects/tdd/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
LogLevel debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
权限
sudo find /home/myname/projects/myproject/ -type f -exec chmod 664 {} \;
sudo find /home/myname/projects/myproject/ -type d -exec chmod 775 {} \;
sudo chown -R myname:www-data /home/myname/projects/myproject/
有没有办法检查错误出在哪里?我的日志里什么都没看到
答案1
我刚刚意识到我试图访问的是 https:// myproject.development 而不是 http:// myproject.development 我花了一整天时间检查一切是否设置正确,结果一位朋友指出了这个显而易见的问题