核心配置:



server {
listen 9998 ssl;
server_name localhost;

# 证书
ssl_certificate "crt文件";
ssl_certificate_key "key文件";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
alias 位置位置
#Nginx日志目录
autoindex on;
#打开目录浏览功能
autoindex_exact_size off;
#默认为on,显示出文件的确切大小,单位是bytes
#显示出文件的大概大小,单位是kB或者MB或者GB
autoindex_localtime on;
#默认为off,显示的文件时间为GMT时间。
#改为on后,显示的文件时间为文件的服务器时间
add_header Cache-Control no-store;
#让浏览器不保存临时文件
}

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}


需要说明的是:

(1)若使用443端口,需要备案

(2)需要上传证书到nginx


作者:孟繁贵