-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
115 lines (88 loc) · 3.67 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
# Example of NGINX configured as a reverse-proxy server with load balancer.
# upstream loadbalancername {
# # https://www.nginx.com/blog/choosing-nginx-plus-load-balancing-techniques
# server localhost:3000;
# server localhost:3001;
# server localhost:3002;
# }
# server {
# listen 80;
# server_name localhost www.example.com example.com;
# location / {
# # To pass a request to an HTTP proxied server
# proxy_pass http://loadbalancername;
# # NGINX redefines two header fields in proxied requests,
# # “Host” and “Connection”, and eliminates the header
# # fields whose values are empty strings
# # https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect
# # To not redirect, but to proxy
# proxy_redirect off;
# }
# }
# Example of NGINX configured as a reverse-proxy WITHOUT load balancer.
# server {
# listen 80;
# server_name www.example2.com example2.com;
# location / {
# proxy_pass http://localhost:3000;
# # https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect
# # To not redirect, but to proxy
# proxy_redirect off;
# }
# }
# Example of NGINX configured as a reverse-proxy WITHOUT load balancer.
# server {
# listen 80;
# server_name www.example2.com example2.com;
# location / {
# proxy_pass http://localhost:3000;
# # https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect
# # To not redirect, but to proxy
# proxy_redirect off;
# }
# }
# Example of NGINX configured as web server serving an static site.
#server {
# listen 80;
# server_name www.matiasoliva.me matiasoliva.me
# location / {
# root /home/user/static-site/;
# }
#}
server {
server_name www.matiasoliva.me matiasoliva.me;
location / {
proxy_pass http://127.0.0.1:3000; # Puerto en el que se ejecuta Uvicorn
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;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/matiasoliva.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/matiasoliva.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.matiasoliva.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = matiasoliva.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name www.matiasoliva.me matiasoliva.me;
return 404; # managed by Certbot
}
96,1 Bot