更改Apache目录以显示Wordpress主页

问题描述 投票:0回答:1

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

我一直在做一些研究,似乎我需要使用Apache进行更改,以便将其直接定向到Wordpress目录/页面。

在此问题上的任何帮助将不胜感激:)

php wordpress amazon-web-services apache bitnami
1个回答
0
投票

您获得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 [email protected]
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /var/www/wordpress
</VirtualHost>
© www.soinside.com 2019 - 2024. All rights reserved.