403禁止访问您没有访问此资源的权限。 -Django

时间:2020-10-28 09:29:35

标签: django apache2

我最近对Django应用程序进行了一些更改,并将其拉回到服务器上。这样做之后,尝试访问我的网站时遇到一些错误消息。

当我访问该网站时,得到Forbidden You don't have permission to access this resource.,在我的/var/log/apache2/portfolio-error.log中,我看到以下错误日志。

[Wed Oct 28 08:51:06.883684 2020] [core:error] [pid 11345:tid 139674953709312] (13)Permission denied: [client xx.xx.xxx.xx:48690] AH00035: access to / denied (filesystem path '/srv/portfolio/portfolio') because search permissions are missing on a component of the path
[Wed Oct 28 08:51:07.085543 2020] [core:error] [pid 11345:tid 139675068827392] (13)Permission denied: [client xx.xx.xxx.xx:48690] AH00035: access to /favicon.ico denied (filesystem path '/srv/portfolio/static') because search permissions are missing on a component of the path, referer: https://example.com/
[Wed Oct 28 08:51:34.899776 2020] [core:error] [pid 12041:tid 140689096595200] (13)Permission denied: [client xx.xx.xxx.xx:48694] AH00035: access to / denied (filesystem path '/srv/portfolio/portfolio') because search permissions are missing on a component of the path
[Wed Oct 28 08:51:35.112403 2020] [core:error] [pid 12041:tid 140689088202496] (13)Permission denied: [client xx.xx.xxx.xx:48694] AH00035: access to /favicon.ico denied (filesystem path '/srv/portfolio/static') because search permissions are missing on a component of the path, referer: https://example.com/

这也是我的项目的权限:

drw-rw-r-- 9 www-data www-data   4096 Oct 26 09:30 .
drwxr-xr-x 4 www-data www-data   4096 Sep 10  2019 ..
drwxr-xr-x 5 root     root       4096 Sep 10  2019 blog
-rw-rw-r-- 1 www-data www-data 155648 Oct 26 09:30 db.sqlite3
drwxr-xr-x 8 root     root       4096 Oct 26 09:38 .git
drwxr-xr-x 5 root     root       4096 Oct 26 09:38 main
-rwxr-xr-x 1 root     root        629 Sep 10  2019 manage.py
drwxrwxr-x 5 www-data www-data   4096 Oct 26 10:07 media
drwxr-xr-x 3 root     www-data   4096 Oct 26 11:16 portfolio
drwxr-xr-x 5 root     root       4096 Oct 26 04:36 projects
drwxrwxr-x 9 dream    dream      4096 Oct 28 08:14 static

/etc/apache2/sites-available/portfolio.conf

<VirtualHost *:443>
    ServerName example.com

    DocumentRoot /srv/portfolio/portfolio

    SSLEngine on
    SSLCertificateFile /etc/ssl/example_com.crt
    SSLCertificateKeyFile /etc/ssl/example_com.key
    SSLCertificateChainFile /etc/ssl/example_com.ca-bundle



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

    WSGIDaemonProcess portfolio processes=2 threads=25 python-path=/svr/portfolio
    WSGIProcessGroup portfolio
    WSGIScriptAlias / /srv/portfolio/portfolio/wsgi.py

    Alias /robots.txt /srv/portfolio/static/robots.txt
    Alias /favicon.ico /srv/portfolio/static/favicon.ico
    Alias /static/ /srv/portfolio/static/
    Alias /media/ /srv/portfolio/media/

    <Directory /srv/portfolio/portfolio>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    <Directory /srv/portfolio/static>
        Require all granted
    </Directory>

    <Directory /srv/portfolio/media>
        Require all granted
    </Directory>
</VirtualHost>

感谢您的帮助:)

0 个答案:

没有答案