简体   繁体   English

404 NOT FOUND错误Magento安装过程

[英]404 NOT FOUND error Magento installation process

I'am trying to install magento 2.4 on ubuntu 20.04我正在尝试在 ubuntu 20.04 上安装 magento 2.4

I've installed magento with composer.我已经用作曲家安装了 magento。

mysql and apach are running fine and php installed correctly as shown below mysql 和 apach 运行良好,php 安装正确,如下所示

All magento commands are working fine so I think magento is working.所有 magento 命令都工作正常,所以我认为 magento 工作正常。 But when I navigate to http://127.0.0.1/magento2/ I get 404 not found as shown below但是当我导航到http://127.0.0.1/magento2/我得到 404 not found 如下所示

I think maybe the problem is with the configs of php and apache我认为问题可能出在 php 和 apache 的配置上

This is my magento config file这是我的 magento 配置文件

/etc/apache2/sites-available/magento2.conf

在此处输入图像描述

mysql and apach are running fine and php installed correctly: mysql 和 apach 运行良好,php 安装正确: 在此处输入图像描述

magento2 directory magento2 目录

在此处输入图像描述

The problem is wen I try to get the magento url, I get this error问题是我尝试获取 magento url,我收到此错误

在此处输入图像描述

UPDATED1:更新1:

http://127.0.0.1/

在此处输入图像描述

Looks like magento 2.4 not support web based installation.check this link看起来 magento 2.4 不支持基于 web 的安装。检查此链接在此处输入图像描述

here are what I recommend for you:以下是我为您推荐的:

  1. you must install magento 2.4 from command line您必须从命令行安装 magento 2.4
  2. make sure you install elasticsearch, and another system requirement, you can check this link确保安装 elasticsearch 和另一个系统要求,您可以查看此链接

if you have install all the requirement system, follow this step:如果您已经安装了所有需求系统,请按照以下步骤操作:

  1. add magento.local to your /etc/hosts将 magento.local 添加到您的 /etc/hosts 在此处输入图像描述
  2. change your apache virtual host like below (make sure change the magento path):更改您的 apache 虚拟主机,如下所示(确保更改 magento 路径):
<VirtualHost *:80>
   ServerName magento.local

   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/magento/
   
   <Directory /var/www/magento/>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride All
           Require all granted
   </Directory>

   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  1. enable vhost and apache rewrite: sudo a2ensite magento && sudo a2enmod rewrite启用虚拟主机和 apache 重写: sudo a2ensite magento && sudo a2enmod rewrite
  2. restart apache: sudo systemctl restart apache2重启 apache: sudo systemctl restart apache2
  3. Install magento using command line:使用命令行安装 magento:
bin/magento setup:install \
--base-url=http://magento.local/ \
--db-host=localhost \
--db-name=db_name \
--db-user=db_user \
--db-password=db_pass \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15
  1. verify the installation, visit: http://magento.local in browser验证安装,在浏览器中访问: http://magento.local

Hope this help you.希望这对您有所帮助。

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

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