为什么服务器显示默认的 Apache 页面而不是我的应用程序?

为什么服务器显示默认的 Apache 页面而不是我的应用程序?

我在我的 Ec2 实例上设置了 Php+Mysql 应用程序,但当我进入域时,显示的是 Apache 默认页面。Bookstack 是我的应用程序。尾部日志

172.68.50.230 - - [21/Apr/2022:05:26:52 +0000] "GET / HTTP/1.1" 304 2539 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"

我的 default.conf 输出 cat 000-default.conf

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    SSLEngine on
    SSLCertificateFile /etc/apache2/certs/pizd.pem
    SSLCertificateKeyFile /etc/apache2/certs/pizd.key
</VirtualHost>

我的 bookstack.conf

<VirtualHost *:80>
    ServerName bookstack

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/bookstack/public/

    <Directory /var/www/bookstack/public/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        <IfModule mod_rewrite.c>
            <IfModule mod_negotiation.c>
                Options -MultiViews -Indexes
            </IfModule>

            RewriteEngine On

            # Handle Authorization Header
            RewriteCond %{HTTP:Authorization} .
            RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

            # Redirect Trailing Slashes If Not A Folder...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} (.+)/$
            RewriteRule ^ %1 [L,R=301]

            # Handle Front Controller...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>

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

我检查了这个

sudo ls -l /etc/apache2/sites-enabled/
total 4
-rw-r--r-- 1 root root 338 Apr 20 14:20 000-default.conf
lrwxrwxrwx 1 root root  33 Apr 18 09:38 bookstack.conf -> ../sites-available/bookstack.conf

我应该尝试什么?

答案1

首先,使用以下命令检查 apache ssl 模块是否已启用:sudo a2enmod ssl

000-default.conf然后在该部分后面添加以下几行DocumentRoot

<Directory /var/www/html/bookstack/public/>
Options FollowSymlinks
AllowOverride All
Require all granted</Directory>

相关内容