Skip to content

Instantly share code, notes, and snippets.

@Naereen
Created March 6, 2017 11:40
Show Gist options
  • Save Naereen/b17e3c4b6b429bbb6300f45e4a6fe2b1 to your computer and use it in GitHub Desktop.
Save Naereen/b17e3c4b6b429bbb6300f45e4a6fe2b1 to your computer and use it in GitHub Desktop.
Configuration for NGinx to proxy uLogMe web-app (https://localhost:8443) to a folder (https://localhost/ulogme). Cf. https://GitHub.com/Naereen/uLogMe/
# Inside the SSL server:
# Local proxy for uLogMe (https://localhost:8443/)
location /ulogme/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_cache off;
proxy_ssl_verify off;
proxy_pass https://localhost:8443/;
}
location /refresh {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_cache off;
proxy_ssl_verify off;
proxy_pass https://localhost:8443/refresh;
}
location /blog {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_cache off;
proxy_ssl_verify off;
proxy_pass https://localhost:8443/blog;
}
location /addnote {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_cache off;
proxy_ssl_verify off;
proxy_pass https://localhost:8443/addnote;
}
@Naereen
Copy link
Author

Naereen commented Mar 6, 2017

Cf. this issue: Naereen/uLogMe#13

@Naereen
Copy link
Author

Naereen commented Mar 6, 2017

« What if I want to serve the uLogMe pages over a restricted network ? »
« Or if you want to access it with a simple URL instead of remembering the exact port ? »

Simple! You can use a local nginx server to set up a proxy, so that: http://localhost/ulogme/ loads its content from http://localhost:8443/.

The basic thing to do is this:

# Local proxy for uLogMe (https://localhost:8443/)
location /ulogme/ {
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_buffering            off;
    proxy_cache                off;
    proxy_ssl_verify           off;
    proxy_pass                 https://localhost:8443/;
}

It works perfectly fine:
demo localhost ulogme

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