配置SSL访问
安装nginx
yum -y install nginx
启动
systemctl start nginx
编辑nginx.conf
配置文件
server {
listen 80;
server_name xxxxxx.cn;
# 重定向所有HTTP流量到HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl ;
server_name xxxxxx.cn;
ssl_certificate /etc/nginx/ssl/xxxxxx.cn_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/xxxxxx.cn.key;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1.2 TLSv1.3;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
client_max_body_size 20M;
add_header Strict-Transport-Security "max-age=31536000";
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
#此处配置 MinDoc 程序的地址和端口号
proxy_pass http://x.x.x.x:xxxx;
}
}
}
验证nginx.conf
文件:
nginx -t
nginx -s reload
开启了文件上传功能,需要在nginx.conf
添加文件上传限制
client_max_body_size 20M;
作者:wiki 创建时间:2024-07-20 15:20
最后编辑:wiki 更新时间:2024-08-13 10:12
最后编辑:wiki 更新时间:2024-08-13 10:12