Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

is it possible to config nginx certificate in public file

Now this is my nginx server config:

server{
    listen 443;

    ssl_certificate /etc/nginx/conf.d/cert/example.com/fullchain1.pem;
    ssl_certificate_key /etc/nginx/conf.d/cert/example.com/privkey1.pem;

    server_name super.example.com;
    #rewrite ^(.*)$ https://${server_name}$1 permanent;
    root /usr/share/nginx/html/pc-super-frontend-fat;

    location / {
        try_files $uri /index.html;
        index index.html index.htm;
    }

    location ^~ /service/ {
        proxy_pass  http://k8s-edge-node/;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

in every server config file, it contains certificate config:

ssl_certificate /etc/nginx/conf.d/cert/example.com/fullchain1.pem;
ssl_certificate_key /etc/nginx/conf.d/cert/example.com/privkey1.pem;
    

because I have more than 50 sub domains, if change the certificate, it should change more than 100 files config(80 + 443). is it possible to make the certificate config to a seperate file and just reference it in server config file?

question from:https://stackoverflow.com/questions/65931069/is-it-possible-to-config-nginx-certificate-in-public-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...