This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
executable file
·40 lines (35 loc) · 1.69 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
server {
disable_symlinks off;
listen 80;
server_name <your_domain>;
root /var/www/<your_instance_name>/; # replace by your domain html path
access_log /var/log/nginx/<your_instance_name>.access.log;
error_log /var/log/nginx/<your_instance_name>.error.log;
client_max_body_size 10M;
# Check if a file exists at /var/www/<your_instance_name>/ for the incoming request.
# If it doesn't proxy to Gunicorn/Django.
location ~ ^/api {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme; # derriere un proxy ssl, mettre 'https' en dur à la pace de '$scheme'
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
keepalive_timeout 0;
proxy_pass http://127.0.0.1:<port_not_used_2>;
}
# Check if a file exists at /var/www/ for the incoming request.
try_files $uri @django;
location @django {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme; # derriere un proxy ssl, mettre 'https' en dur à la pace de '$scheme'
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
keepalive_timeout 0;
proxy_pass http://127.0.0.1:<port_not_used_1>;
}
}