-
Notifications
You must be signed in to change notification settings - Fork 0
/
tedxuwa_nginx.conf
177 lines (147 loc) · 5.42 KB
/
tedxuwa_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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# tedxuwa_nginx.conf
# on new deployment copy the content of this file to /etc/nginx/sites-available/default
# run sudo /etc/init.d/nginx restart to restart nginx
# from https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
# configuration of the server
server {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
# the port your site will be served on
# the domain name it will serve for
server_name tedxuwa.com www.tedxuwa.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
# client_max_body_size 75M; # adjust to taste
# Finally, send all non-media requests to the Django server.
location / {
include proxy_params;
proxy_pass http://unix:/root/website/back-end/root.sock;
}
location /static {
autoindex on;
alias /root/website/back-end/static/;
expires 365d;
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tedxuwa.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tedxuwa.com/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
# optimise ssl options
# https://bjornjohansen.no/optimizing-https-nginx
ssl_session_cache shared:SSL:10m;
# compression
# https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04
gzip on;
gzip_vary on;
gzip_disable "msie6";
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
}
server {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
if ($host = www.tedxuwa.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = tedxuwa.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name tedxuwa.com www.tedxuwa.com;
return 404; # managed by Certbot
}
# redirect ticket site, http and https
server {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
server_name ticket.tedxuwa.com;
location / {
return 307 https://tedxuwa.com/tickets$request_uri;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tedxuwa.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tedxuwa.com/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 {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
server_name tickets.tedxuwa.com;
location / {
return 307 https://tedxuwa.com/tickets$request_uri;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tedxuwa.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tedxuwa.com/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 {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
server_name t.tedxuwa.com;
location / {
return 307 https://tedxuwa.com/r$request_uri;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tedxuwa.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tedxuwa.com/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 {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
if ($host = ticket.tedxuwa.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name ticket.tedxuwa.com;
return 404; # managed by Certbot
}
server {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
if ($host = tickets.tedxuwa.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name tickets.tedxuwa.com;
return 404; # managed by Certbot
}
server {
# certbot webroot redirect
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /home/www/letsencrypt;
}
if ($host = t.tedxuwa.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name t.tedxuwa.com;
return 404; # managed by Certbot
}