use ssl in nginx

This commit is contained in:
liaojack8 2020-07-05 01:33:25 +08:00
parent 97e7352f57
commit 5f424722f7
1 changed files with 13 additions and 4 deletions

View File

@ -131,10 +131,19 @@ echo -e "\033[1;32m“nginx”起一个web服务......\033[0m"
cd $nginx_conf cd $nginx_conf
echo "server { echo "server {
listen 80; listen 80;
server_name $YOUR_DOMAIN_NAME; server_name ecbot.nctu.me;
location / { return 301 https://$host$request_uri;
proxy_pass http://127.0.0.1:23333/; }
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/ssl/certificate-all.crt;
ssl_certificate_key /etc/ssl/private.key;
server_name $YOUR_DOMAIN_NAME;
location / {
proxy_pass http://127.0.0.1:23333/;
} }
}" >${nginx_conf}gdutilsbot.conf && }" >${nginx_conf}gdutilsbot.conf &&
$rm_nginx_default $rm_nginx_default