Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created January 28, 2019 11:41
Show Gist options
  • Select an option

  • Save jmercouris/73776f7b0983bc458814286d04838308 to your computer and use it in GitHub Desktop.

Select an option

Save jmercouris/73776f7b0983bc458814286d04838308 to your computer and use it in GitHub Desktop.
########################################################################
# CURRENT CONFIGURATION
########################################################################
server {
listen 80;
server_name www.example.com example.com;
return 301 https://$host$request_uri;
location /static/ {
alias /root/directory/static/;
autoindex on;
}
location / {
proxy_pass http://127.0.0.1:5000;
}
}
########################################################################
# NEW CONFIGURATION
########################################################################
server {
listen 80;
server_name www.example.com example.com;
return 301 https://$host$request_uri;
location / {
try_files $uri $uri/ @backend;
}
location @backend {
proxy_pass http://127.0.0.1:5000;
}
}
########################################################################
# Contents of static folder
########################################################################
/static
/static/images
/static/js
/static/css
... etc
########################################################################
# How they are referenced in HTML
########################################################################
<img src="images/file.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment