2

安装 Magento 2 后,我无法加载 magento 主页,因为它显示以下错误

NetworkError: 404 Not Found - http://local-magento2.com/setup/index.php/navigation/menu

有人可以帮我加载主页吗?

4

2 回答 2

2

您的基本 URL 是否正确?您是否启用了 .htaccess 和服务器重写?

http://devdocs.magento.com/guides/v2.0/install-gde/trouble/tshoot_access-browser.html

http://devdocs.magento.com/guides/v2.0/install-gde/trouble/tshoot_no-styles.html

于 2015-08-26T13:40:15.667 回答
1

有几点需要注意:

1 - 文件所有权:您必须确保整个 Magento2 安装的文件所有权是whatever_user:server_name - 例如,我的文件所有权是 vagrant:www-data,就像我在 Ubuntu 上的 Vagrant Box 上一样。您可能需要将所有权设置为myuser:apache 或 myuser:nginx

在您的终端上运行它:

sudo chown youruser:www-data /var/www/html/

2 - 用户和组:确保您用于设置所有权的用户在“彼此的组”中 - 对我来说,我必须在 www-data 组中添加 vagrant 用户,在 www-data 组中添加用户流浪团。

在您的终端上运行它:

sudo usermod -a -G youruser,www-data vagrant

sudo usermod -a -G www-data,youruser www-data

要验证这一点,您可以在终端上运行它:

sudo groups youruser

完成后,重新启动服务器,如下所示:

sudo service apache2 restart -or- sudo service httpd restart

3 - 通过在终端上运行它来设置您的文件和文件夹权限:

find . -type d -exec chmod 770 {} \;

find . -type f -exec chmod 660 {} \;

4 - 通过在终端上运行它来启用 Apache 重写模块:

a2enmod rewrite

5 - 通过在终端上运行它来启用 Apache 分布式配置:

sudo nano /etc/apache2/sites-available/000-default.conf

转到文件的最后一行并添加以下内容:

<Directory "/var/www/html">
    AllowOverride  All
</Directory>

** 确保您的 Magento2 根文件夹的路径已在上面更新(/var/www/html),因为您的路径可能是 /var/www/magento2 或您所称的任何名称。

完成后,重新启动服务器,如下所示:

sudo service apache2 restart** -or- **sudo service httpd restart

在花了几个小时尝试不同的场景后,这对我有用。以下是一些真正帮助我的链接:

http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache-user.html#install-update-depend-user-add2group

http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html#apache-rewrites2.4

祝你好运 ;)

于 2016-04-28T16:06:52.720 回答