Last active
January 31, 2019 13:35
-
-
Save neevai/2d591842a7013dd615554d99dc657221 to your computer and use it in GitHub Desktop.
Nginx configuration server block for static frontend and websocket backend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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