Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save viktor-shmigol/75c8981d841f7a9e5a0ffd316c732e48 to your computer and use it in GitHub Desktop.
Save viktor-shmigol/75c8981d841f7a9e5a0ffd316c732e48 to your computer and use it in GitHub Desktop.
Proxy Nginx
server {
listen 9000 default_server;
listen [::]:9000 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /api {
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;
rewrite ^/api/?(.*) /$1 break;
proxy_pass http://api_node_js;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment