角度服务人员504

时间:2020-06-12 21:49:52

标签: angular

我正在尝试使用服务工作者根据Angular应用程序设置PWA。我按照以下指南进行了设置:

https://medium.com/poka-techblog/turn-your-angular-app-into-a-pwa-in-4-easy-steps-543510a9b626

现在,当我以脱机模式在浏览器中运行此代码时,它会显示给我:

HTTP 504, it takes too long before <<host>> replies. 

我认为错误是在我的nginx.conf中,而不是在Angular应用程序方面,但是我似乎无法弄清楚。我已经尝试过在此问题中建议的解决方案:

Angular service worker with @angular/pwa package showing `HTTP error 504` when offline

但这也不能解决我的问题,我的nginx conf如下:

server {
        listen host:443 ssl http2;

        server_name app.host.net;
        server_name www.app.host.net;
        server_name ipv4.app.host.net;

        ssl_certificate             /usr/local/psa/var/certificates/scfSIGTFJ;
        ssl_certificate_key         /usr/local/psa/var/certificates/scfSIGTFJ;

        client_max_body_size 128m;

        root "/var/www/vhosts/host.net/app.host.net";
        access_log "/var/www/vhosts/system/app.host.net/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/app.host.net/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

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass https://ip: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;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;


        }


        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/host.net/app.host.net/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass https://ip: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;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        #add_header X-Powered-By PleskLin;

}
server {
        listen ip:80;

        server_name host.net;
        server_name www.host.net;
        server_name ipv4.host.net;

        client_max_body_size 128m;

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

0 个答案:

没有答案