Skip to content

Instantly share code, notes, and snippets.

@neevai
Last active January 31, 2019 13:35
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 neevai/2d591842a7013dd615554d99dc657221 to your computer and use it in GitHub Desktop.
Save neevai/2d591842a7013dd615554d99dc657221 to your computer and use it in GitHub Desktop.
Nginx configuration server block for static frontend and websocket backend
# Nginx configuration server block for static frontend and websocket backend
# For example - React and Gunicorn or Angular and Rack
#
# Setup:
# sudo cp nginx.conf /etc/nginx/sites-available/mynewconfig
# sudo ln -s /etc/nginx/sites-available/mynewconfig /etc/nginx/sites-enabled
# sudo rm /etc/nginx/sites-enabled/default
# sudo service nginx restart
#
server {
listen 80;
server_name _;
location /api {
include proxy_params;
proxy_pass http://unix:/path/to/socket/file/file.sock;
}
location / {
alias /path/to/static/folder;
try_files $uri /index.html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment