-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-app_server-nginx_config
executable file
·54 lines (46 loc) · 1.6 KB
/
4-app_server-nginx_config
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
42
43
44
45
46
47
48
49
50
51
52
53
54
server {
listen 80;
listen [::]:80 default_server;
server_name _;
# Add header to identify the server
add_header X-Served-By $hostname;
# Define the root for static files
root /var/www/html;
index index.html index.htm;
# Redirect example
location /redirect_me {
return 301 https://www.youtube.com/watch?v=QH2-TGUlwu4;
}
# Proxy pass configuration for /airbnb-onepage
location /airbnb-onepage {
proxy_pass http://127.0.0.1:5000;
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 pass configuration for /airbnb-dynamic/number_odd_or_even/
location ~ ^/airbnb-dynamic/number_odd_or_even/(\d+)$ {
proxy_pass http://127.0.0.1:5001;
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 pass configuration for /api/
location /api/ {
proxy_pass http://127.0.0.1:5002;
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;
}
# Serve static files from this directory
location /hbnb_static {
alias /data/web_static/current/;
}
# Default location configuration
location / {
try_files $uri $uri/ =404;
}
}