Apache2非默认根目录多个网站403禁止

Apache2非默认根目录多个网站403禁止

我在 AWS 的自动扩展组中安装了 Ubuntu 20.04 服务器,EFS 安装在/mnt/efs/fs1

我使用 codedeploy 部署非默认网站。bitbucket 管道创建一个包含网站配置和网站内容的 zip 文件。Codedeploy 部署部分如下:

#extract content
unzip -o frontend-qa.zip
#copy site config
sudo mv /mnt/efs/fs1/sites-enabled/* /etc/apache2/sites-enabled/
#update permissions
sudo chown www-data:www-data -R /mnt/efs/fs1/www
sudo chmod 777 -R /mnt/efs/fs1/www
#reload apache
sudo systemctl reload apache2

/etc/apache2/apache2.conf负责目录和权限的部分

<Directory /mnt/efs/fs1/www>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

网站 vhost 文件

<VirtualHost *:80>
      ServerAdmin admin@the_site
      ServerName the_site
      ServerAlias www.the_site
      DocumentRoot /mnt/efs/fs1/www/html/site_admin/public_html
      # Directory path where code exists
        <Directory /mnt/efs/fs1/www/html/site_admin/public_html>
                Options -Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/the_site.site-error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel error
        CustomLog ${APACHE_LOG_DIR}/the_site.log combined
</VirtualHost>

网站根目录的权限

ll /mnt/efs/fs1/www/html/site_admin/public_html/
total 2120
drwxrwxrwx 10 www-data www-data    6144 Nov 28 16:35  ./
drwxrwxrwx  3 www-data www-data    6144 Nov 16 13:31  ../
-rwxrwxrwx  1 www-data www-data     283 Nov 26 18:48  .gitignore*
-rwxrwxrwx  1 www-data www-data   13966 Nov 28 16:35  .htaccess*
-rwxrwxrwx  1 www-data www-data     305 Nov 26 18:48  .project*
-rwxrwxrwx  1 www-data www-data      23 Nov 26 18:48  HEAD*
-rwxrwxrwx  1 www-data www-data  343872 Nov 26 18:48 'Hi tea menu.pdf'*
drwxrwxrwx 15 www-data www-data    6144 Nov  5 23:39  application/
drwxrwxrwx 13 www-data www-data    6144 Nov  5 23:39  assets/
-rwxrwxrwx  1 www-data www-data     339 Nov 26 18:48  composer.json*
-rwxrwxrwx  1 www-data www-data   65865 Nov 26 18:48  composer.lock*
-rwxrwxrwx  1 www-data www-data 1640731 Nov 26 18:48  composer.phar*
-rwxrwxrwx  1 www-data www-data      66 Nov 26 18:48  config*
-rwxrwxrwx  1 www-data www-data      73 Nov 26 18:48  description*
-rwxrwxrwx  1 www-data www-data      66 Nov 26 18:48  desktop.ini*
-rwxrwxrwx  1 www-data www-data       0 Nov 26 18:48  error.log*
-rwxrwxrwx  1 www-data www-data       0 Nov 26 18:48  git*
drwxrwxrwx  2 www-data www-data    6144 Nov  5 23:39  hooks/
drwxrwxrwx  2 www-data www-data   14336 Nov  5 23:39  images/
-rwxrwxrwx  1 www-data www-data    6457 Nov 26 18:48  index.php*
drwxrwxrwx  2 www-data www-data    6144 Nov  5 23:39  info/
-rwxrwxrwx  1 www-data www-data    2496 Nov 26 18:48  license.txt*
drwxrwxrwx  8 www-data www-data    6144 Nov  5 23:40  system/
drwxrwxrwx  3 www-data www-data    6144 Nov  5 23:39  uploads/
drwxrwxrwx 22 www-data www-data    6144 Nov  5 23:46  vendor/

当我尝试加载网站时,我得到了403 Forbidden You don't have permission to access this resource.

/var/log/apache2/access.log是空的

/var/log/apache2/error.log具有以下内容:

AH01630: client denied by server configuration: /var/www/html

/var/log/apache2/the_site.log是空的

/var/log/apache2/the_site-error.log也是空的

非常感谢你的帮助

谢谢 Igal

答案1

这个问题通过重新安装 EFS 卷来解决/var/www

相关内容