Files
Deployments/NginxAndLetsencrypt/server/nginx/conf/conf.d/sample.conf
2020-04-26 14:39:13 +08:00

42 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name git.woyue.org;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name git.woyue.org;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/git.woyue.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.woyue.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
#此处的IP是其他Docker Container的IP。注意
#1不需要在compose nginx和letsencrypt的阶段就配置好下面的内容
#2配置完成后执行 docker inspect nginxdocker_nginx_1 来确定所在网络名称。如:
#"Networks": {
# "nginxdocker_default": {
#3在接下来要运行的应用的docker-compose文件中指定外部网络名称为上述名称。参见sampleApp示例。
#4用docker inspect命令确定应用的container的IP填入下方即可。
proxy_pass http://172.17.0.1:17000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}
}