Polymer / prpl-server

⚠️Maintenance mode⚠️ An HTTP server for Node designed to serve PRPL apps in production.
Other
425 stars 29 forks source link

how to config nginx to proxy prpl-server? #50

Closed Gaubee closed 7 years ago

Gaubee commented 7 years ago

I need a .conf template file. some body help please. (づ。◕‿‿◕。)づ

Gaubee commented 7 years ago

I use prpl-server-node and Certbot . this is my config, work for me :

server{
        listen          80;
        index           index.html;
        server_name     gaubee.com;

    listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/gaubee.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/gaubee.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    location / {
        proxy_pass http://127.0.0.1:8080/;
        proxy_set_header X-Forwarded-Proto $scheme;
#        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Server $host;
        proxy_read_timeout 3m;
        proxy_send_timeout 3m;
        proxy_buffer_size  128k;
        proxy_buffers   32 32k;
        proxy_busy_buffers_size 128k;
    }
}

the buffer size must be large enough, because http/2 push will write preload file list in headers.