upstream web-portal{
server 127.0.0.1:5050;
keepalive 15;
}
server {
listen 80;
server_name demo.site.ru;
access_log /var/log/nginx/web-portal.log;
location / {
proxy_pass http://web-portal;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
}
location /socket.io/ {
proxy_pass http://web-portal;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location ~* \.(?:jpg|jpeg|gif|png|css|js)$ {
root /var/projects/web.portal/current/public;
}
}
upstream web-portal {
server 127.0.0.1:5050;
keepalive 15;
}
server {
listen 80;
server_name demo.portal.ru;
root /var/projects/web.portal/current/public;
access_log /var/log/nginx/web-portal.log;
error_log /var/log/nginx/web-portal.error.log;
location / {
proxy_pass http://web-portal;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
}
location ^~ /socket {
rewrite ^/socket/(.*) /$1 break; #used to send request to base url
proxy_pass http://web-portal;
proxy_redirect off;
proxy_pass_request_headers on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location ~* \.(?:jpg|jpeg|gif|png|css|js)$ {
expires 30d;
}
}