Skip to content

Instantly share code, notes, and snippets.

@alincc
Created October 10, 2017 20:46
Show Gist options
  • Select an option

  • Save alincc/c05cac61347803f65014dbd10990d3cd to your computer and use it in GitHub Desktop.

Select an option

Save alincc/c05cac61347803f65014dbd10990d3cd to your computer and use it in GitHub Desktop.
# /etc/nginx/conf.d/site.conf
# Site (port 80 -> 9090)
server {
listen 80; # Listen on port 80 for IPv4 requests
server_name localhost;
access_log /var/log/nginx/site_access.log;
error_log /var/log/nginx/site_error.log;
# Set the root of the static content
root /usr/share/nginx/html;
# Redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# Filter static content types and serve from the root
location ~*\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
# Serve the dynamic content (Site)
location / {
# The application provides its own detailed logs
access_log off;
# Hand over to the application
proxy_pass http://localhost:9090/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment