nginx配置ssl證書實現https訪問

一、nginx.conf配置文件html

server { listen 80; server_name www.abc.lynch.com abc.lynch.com; error_log /usr/share/nginx/html/test/pay_local.error; client_max_body_size 60M; client_body_buffer_size 512k; location / { root /usr/share/nginx/html/kshop; index index.html; autoindex on; } # rewrite ^(.*) https://$server_name$1 permanent; 
} server { listen 443 ssl; server_name www.abc.lynch.com abc.lynch.com; error_log /usr/share/nginx/html/test/pay_local.error; client_max_body_size 60M; client_body_buffer_size 512k; location / { root /usr/share/nginx/html/kshop; index index.html; autoindex on; } ssl_certificate /etc/nginx/conf.d/fullchain.pem; #證書位置 ssl_certificate_key /etc/nginx/conf.d/privkey.pem; #私鑰位置 }

 

二、啓動nginx,映射443端口nginx

docker run --restart=always --name nginx_erp_test -d -p 80:80 -p 443:443 -v /www/html/attachment:/www/html/attachment -v /data/nginx/html:/usr/share/nginx/html -v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf  -v /data/nginx/logs:/var/log/nginx -v /data/nginx/conf.d:/etc/nginx/conf.d nginx
相關文章
相關標籤/搜索