33 lines
887 B
Plaintext
33 lines
887 B
Plaintext
|
server{
|
||
|
listen 80;
|
||
|
|
||
|
server_name ${DOMAIN_NAME};
|
||
|
|
||
|
#(第一种)把http的域名请求转成https
|
||
|
#return 301 https://$host$request_uri;
|
||
|
|
||
|
#(第二种)强制将http的URL重写成https
|
||
|
rewrite ^(.*) https://$server_name$1 permanent;
|
||
|
}
|
||
|
|
||
|
server {
|
||
|
listen 443 ssl;
|
||
|
listen [::]:443 ssl;
|
||
|
|
||
|
ssl_certificate /etc/nginx/conf.d/cert/nginx.pem;
|
||
|
ssl_certificate_key /etc/nginx/conf.d/cert/nginx.key;
|
||
|
|
||
|
location / {
|
||
|
proxy_set_header X-FORWARDED-FOR $remote_addr;
|
||
|
proxy_set_header X-FORWARDED-PROTO $scheme;
|
||
|
proxy_set_header Host $http_host;
|
||
|
proxy_pass http://blog:4000;
|
||
|
}
|
||
|
|
||
|
location /twikoo {
|
||
|
proxy_pass http://blog-twikoo:8080;
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
}
|
||
|
|
||
|
}
|