Django + Plesk + Apache - 在某些网址上禁止 403 但 404 的显示应用程序是 运行...?

Django + Plesk + Apache - Forbidden 403 on certain urls but 404's show application is running...?

免责声明:这很可能是一个重复的答案。但是,我对此非常尝试,沮丧和迷失。很高兴有人能指出我正确的方向! :)

问题:

使用 Plesk Onyx,我正在尝试通过 Apache 部署我的 Django 应用程序。

我在某些 url 上看到 Forbidden 403,但在抛出 404 的其他人上看到 404。因此,Django 应用程序是 "working" - 但我的权限在某个地方遇到了障碍。 ..

所以 - 导航到 https://api.winduplordvexxos.com/admin/ or https://api.winduplordvexxos.com 撞到了一堵完整的 403 砖墙。

但是,当导航到任何 404 时,我看到 Django 404 url 查找错误页面:

这是进步 - wsgi 进程在那里工作。

我的 http 和 https 指令如下,还有空白的 nginx 指令:

以上配置适用于手动部署到未安装 nginx 的服务器...

看到这个页面让我充满了希望! :D 我快到了...

N.B.: mod_wsgi 已安装。我是 运行 Ubuntu 16.04。我的服务器安装了 Plesk Onyx。 Nginx 正在妨碍等等等等

所以,我的理论解决方案可能涉及 nginx?关掉它? :D

或者允许它与 Apache 一起工作...?

更新:如果有用,这是我的域的 nginx conf 文件:

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 104.248.238.218:443 ssl http2;

        server_name api.winduplordvexxos.com;
        server_name www.api.winduplordvexxos.com;
        server_name ipv4.api.winduplordvexxos.com;

        ssl_certificate             /opt/psa/var/certificates/scfmLBLuq;
        ssl_certificate_key         /opt/psa/var/certificates/scfmLBLuq;
        ssl_client_certificate      /opt/psa/var/certificates/scfFzGCFF;

        client_max_body_size 128m;

        root "/var/www/vhosts/winduplordvexxos.com/api.winduplordvexxos.com/public";
        access_log "/var/www/vhosts/system/api.winduplordvexxos.com/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/api.winduplordvexxos.com/logs/proxy_error_log";

        #extension letsencrypt begin
        location /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        location / {
                proxy_pass https://104.248.238.218:7081;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                access_log off;

        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass https://104.248.238.218:7081;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                access_log off;

        }

        location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                alias /var/www/vhosts/winduplordvexxos.com/web_users//;
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:///var/www/vhosts/system/api.winduplordvexxos.com/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        location ~ ^/~(.+?)(/.*)?$ {
                proxy_pass https://104.248.238.218:7081;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                access_log off;

        }

        location ~ \.php(/.*)?$ {
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:///var/www/vhosts/system/api.winduplordvexxos.com/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        location ~ /$ {
                index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml";
        }

        add_header X-Powered-By PleskLin;

        include "/var/www/vhosts/system/api.winduplordvexxos.com/conf/vhost_nginx.conf";
}

server {
        listen 104.248.238.218:80;

        server_name api.winduplordvexxos.com;
        server_name www.api.winduplordvexxos.com;
        server_name ipv4.api.winduplordvexxos.com;

        client_max_body_size 128m;

        return 301 https://$host$request_uri;
}

在 Plesk Onyx 中,我需要导航到以下内容:

  • 转到 "Tools & Settings" 然后转到 "Services Management"

  • 在"Services Management"下找到"Reverse Proxy Server (nginx)"

  • 找到后,只需停止 "Reverse Proxy Server (nginx)" 服务即可。

知道怎么做就很简单! (完成luck/chance/desperation!)