Last active
February 10, 2017 20:33
-
-
Save LopatkinEvgeniy/df579ed43fbba3b07273 to your computer and use it in GitHub Desktop.
nginx
This file contains hidden or 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
# Простой пример | |
server { | |
listen 80; | |
server_name localhost; | |
charset koi8-r; | |
location / { | |
root /var/www/nodejs/public; | |
index index.html; | |
try_files $uri $uri/ @backend; | |
} | |
location @backend { | |
proxy_pass http://localhost:9001; | |
proxy_http_version 1.1; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X_Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_connect_timeout 20; | |
} | |
} | |
# Рабочий пример | |
server { | |
listen 80 default_server; | |
listen 443 ssl; | |
client_max_body_size 1G; | |
ssl_certificate /etc/nginx/server.crt; | |
ssl_certificate_key /etc/nginx/server.key; | |
root /srv/raidix/public; | |
index index.html; | |
error_log /var/log/nginx/error; | |
access_log /var/log/nginx/access; | |
location / { | |
try_files $uri $uri/ @api; | |
} | |
location @api { | |
proxy_pass http://localhost:9001; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location /websockify { | |
proxy_pass http://localhost:8787/websockify; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment