1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| server { listen 443 ssl http2;
server_name loolob;
# 阿里云证书配置 Start ssl_certificate /root/pem/fullchain.crt; ssl_certificate_key /root/pem/private.pem; ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; # 阿里云证书配置 End
# 设置跨域配置 Start set $cors_origin ""; if ($http_origin ~* "^http://localhost$"){ set $cors_origin $http_origin; }
# add_header Access-Control-Allow-Origin $cors_origin always; add_header Access-Control-Allow-Origin http://loolob.cn; add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS always; add_header Access-Control-Allow-Credentials true always; add_header Access-Control-Allow-Headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token always; add_header Access-Control-Max-Age 1728000 always;
# 预检请求处理 if ($request_method = OPTIONS) { return 204; } # #设置跨域配置 End
include /root/loolob_blog/live2d_api/nginx.conf; include /root/loolob_blog/liry-web-go/nginx.conf; }
server { listen 80; server_name loolob
# 设置跨域配置 Start set $cors_origin ""; if ($http_origin ~* "^http://localhost$"){ set $cors_origin $http_origin; }
# add_header Access-Control-Allow-Origin $cors_origin always; add_header Access-Control-Allow-Origin http://loolob.cn; add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS always; add_header Access-Control-Allow-Credentials true always; add_header Access-Control-Allow-Headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token always; add_header Access-Control-Max-Age 1728000 always;
# 预检请求处理 if ($request_method = OPTIONS) { return 204; } # #设置跨域配置 End
rewrite ^(?!.*api).*$ https://$host$1;
# include /root/loolob_blog/hexo_blog/nginx.conf; include /root/loolob_blog/live2d_api/nginx.conf; include /root/loolob_blog/liry-web-go/nginx.conf; }
|