【问题标题】:Change Apache directory to show Wordpress homepage更改 Apache 目录以显示 Wordpress 主页
【发布时间】:2020-05-31 15:28:38
【问题描述】:

我使用 AWS EC2 实例安装了 Wordpress。公共 IP 为here。我使用 LetsEncrypt 来获取 SSL,效果很好。但在那之后,我的主页现在显示“Apache2 Ubuntu 默认页面”。它应该向我展示 Wordpress 主页。我仍然可以通过 ssh 访问 EC2 (Bitnami Wordpress),所以我的数据应该还在那里。

我一直在做一些研究,似乎我需要使用 Apache 更改某些内容,以便将其直接指向 Wordpress 目录/页面。

在这件事上的任何帮助将不胜感激:)

【问题讨论】:

标签: php wordpress amazon-web-services apache bitnami


【解决方案1】:

这里是 Bitnami 工程师,

您似乎在机器中安装了 Apache2 系统的服务,并且它在启动时启动。 Bitnami 应用程序不使用系统的服务。这就是为什么 Bitnami 的 Apache 服务无法启动的原因,因为其他服务已经在 80 端口运行。为了停止和禁用它,请运行这些命令

sudo service apache2 stop
sudo service apache2 disable
sudo /opt/bitnami/ctlscript.sh start apache

乐于助人!

【讨论】:

    【解决方案2】:

    您获得了 Apache 默认页面这一事实是一个好兆头,这意味着从网络的角度来看,一切都在正常工作。现在,您只需要向 Apache 展示在哪里提供您的文件。

    Apache 通常将其默认配置存储在 /etc/httpd/httpd.conf/etc/apache2/sites-available/default 中,如下所示。

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    

    在更改此文件之前(无论何时找到它),您还需要知道DocumentRoot 的位置。这实际上是您的index.php 所在的目录。在上面的示例中,它位于/var/www,这通常是开始查找的好地方。

    如果您很难找到您的根目录,您可以执行find / -type f -name "index.php" 之类的操作。

    假设您的index.php/var/www/wordpress 中,您的配置可能看起来像这样简单。

    <VirtualHost *:80>
            ServerAdmin admin@example.com
            ServerName example.com
            ServerAlias www.example.com
            DocumentRoot /var/www/wordpress
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-01
      • 2014-08-03
      • 2019-07-28
      • 2016-12-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多