3c3-nginx配置https
小于 1 分钟
nginx配置https
下载证书
server {
# SSL configuration
#
listen 443 ssl ;
listen [::]:443 ssl ;
server_name huxzhi.fun ;
ssl_certificate cert/9405807_huxzhi.fun.pem;
ssl_certificate_key cert/9405807_huxzhi.fun.key;
# ...
强制开启https
/etc/nginx/sites-enabled
server {
listen 80 ;
listen [::]:80 ;
# 匹配所有域名
server_name _;
return 301 https://$host$request_uri;
root /var/www;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}