-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnginx-conf
41 lines (33 loc) · 1.47 KB
/
nginx-conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
server {
listen 80;
server_name IP/DOMAIN; # Change to your Public IP Address or use a Domain with DNS A Record pointed to your Public IP address
# Main location block to serve your application at /
location / {
# Create a user ` htpasswd -c /etc/nginx/.htpasswd USERNAMEHERE `
auth_basic "Restricted Area"; # This is the realm name that will appear in the authentication dialog
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:3000/;
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_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Origin http://127.0.0.1:3000;
# Prevent proxying loops
proxy_redirect off;
# Allow serving static assets correctly
try_files $uri $uri/ @proxy;
# Disable buffering for proxied responses
proxy_buffering off;
}
# Fallback for anything that doesn't match
location @proxy {
proxy_pass http://127.0.0.1:3000;
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_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Origin http://127.0.0.1:3000;
}
}