【问题标题】:EC2 Ubuntu Wordpress index.php 404 errorEC2 Ubuntu Wordpress index.php 404 错误
【发布时间】:2017-04-25 23:32:21
【问题描述】:

我使用 Ubuntu 在 AWS EC2 上安装了 APM 和 wordpress,所有机器似乎都运行良好。但是当我尝试访问 http://"myurl"/index.php 时出现 404 错误

以下是我在 /etc/apache2/sites-available/* 中的文件

000-default.conf

默认-ssl.conf

这些是 /var/www 中的文件和文件夹列表

我也尝试从 DocumentRoot 中删除 '/html' 并使其成为“/var/www”,但它仍然无法正常工作。

我需要你们的帮助谢谢!

【问题讨论】:

    标签: wordpress apache ubuntu amazon-ec2 http-status-code-404


    【解决方案1】:

    1)通过点击设置->永久链接中的保存按钮创建一个新的

    单击该字段并按 CTRL + a 以全选。粘贴到 .htaccess

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    </IfModule>
    

    2) 启用 mod_rewrite:

    sudo a2enmod rewrite
    

    这将激活模块或提醒您该模块已生效。要使这些更改生效,请重新启动 Apache:

    3) 转到这个文件只需更改"AllowOverride None" to AllowOverride all

    sudo nano /etc/apache2/apache2.conf

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    
    sudo service apache2 restart
    

    现在页面开始正常工作了...

    【讨论】:

      【解决方案2】:

      您的配置位于 /etc/apache2/sites-available/。您应该通过在 /etc/apache2/sites-enabled/ 中创建配置来“激活”您的站点。您可以在那里复制或移动您的配置文件,或者只是符号链接它。但正确的做法是调用a2ensite 命令:

      sudo a2ensite 000-default.conf
      

      【讨论】:

      • 我在 /etc/apache2/sites-enabled/ 中也有 000-default.conf 文件...具有相同的 DocumentRoot
      猜你喜欢
      • 2019-07-10
      • 2015-10-18
      • 2017-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      • 2018-04-28
      • 1970-01-01
      相关资源
      最近更新 更多