Skip to content

Instantly share code, notes, and snippets.

@klinquist
Created May 31, 2018 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klinquist/be821a8f068cb15a4db470c055b0ef2a to your computer and use it in GitHub Desktop.
Save klinquist/be821a8f068cb15a4db470c055b0ef2a to your computer and use it in GitHub Desktop.
NGINX reverse proxy config for Proscan
# IP address of the computer running Proscan. Assuming it's running on port 80
upstream scanner {
server 192.168.0.99;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 127.0.0.1:443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/geekflat.linquist.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/geekflat.linquist.net/privkey.pem;
root /var/www/html;
autoindex on;
location /scannerrecordings {
root /var/www/html;
autoindex on;
}
location /scanner {
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://scanner;
# Make sure the subs_filters don't only apply to only text/html
subs_filter_types *;
#This is to make websockets to work (ws_main.js:211)
subs_filter \"http\",\s\"ws\" \"https\",\"wss\" gr;
subs_filter http://geekflat.linquist.net:80 https://geekflat.linquist.net/scanner gr;
subs_filter http://geekflat.linquist.net/(.*) https://geekflat.linquist.net/scanner/$1 gir;
rewrite ^/scanner/(.*) /$1 break;
proxy_ignore_client_abort on;
}
}
@dtsizemore
Copy link

Thank you a tremendous amount for putting this out here. It saved me pulling most of my hair out fighting with NGINX to get PS working through it. Cheers!

@H2OKing89
Copy link

H2OKing89 commented Nov 9, 2020

Hello. I'm trying to get this to work. I get an error with sub_filters. am I to change them or something? If I # them out I can get the web server running but it's not fully passing.

              # Make sure the subs_filters don't only apply to only text/html
                subs_filter_types *;

                #This is to make websockets to work (ws_main.js:211)
                subs_filter \"http\",\s\"ws\" \"https\",\"wss\" gr;

                subs_filter http://geekflat.linquist.net:80 https://geekflat.linquist.net/scanner gr;
                subs_filter http://geekflat.linquist.net/(.*) https://geekflat.linquist.net/scanner/$1 gir;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment