Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. @wernersmit wernersmit created this gist Mar 7, 2017.
    36 changes: 36 additions & 0 deletions plesk-nginx-extra-reverse-proxy.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@

    ## If someone enters two slashes, '//' combine them into one
    merge_slashes on;

    ## Make sure everything is forwarded to https://
    if ($scheme = http) {
    return 301 http://$server_name$request_uri;
    }

    ## Remove trailing slashes
    rewrite ^/(.*)/$ /$1 permanent;

    ## If the index.html (can be anything) is looked for, redirect to /
    ## Fix for Plesk location /{} forcing index.html to be loaded
    rewrite ^(.+)/index.html$ $1 permanent;

    location = /index.html {
    internal;
    error_page 404 =301 $scheme://domain.com/;
    }

    ## If the location is equal to /
    location = / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.0.0.1:3000;
    }

    ## Proxy pass everything else to node as well
    location ~ / {

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.0.0.1:3000;

    }