CentOS环境下Nginx配置SSL证书实现https请求详解(centos环境下hadoop的安装与配置)原创

随心笔谈11个月前发布 admin
93 0

#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.codecoord.com codecoord.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
# https
server {
# 注意这里就是443 ssl, 不要把ssl删除
listen 443 ssl;
# 替换为SSL绑定的域名, 如www.codecoord.com
server_name www.codecoord.com;
# 添加默认主目录和首页, 根据自己的路径修改
root /opt/nginx/html;
index index.html;
# cert.pem和cert.key替换为上传文件的路径
ssl_certificate /opt/nginx/cert/www.codecoord.com.pem;
ssl_certificate_key /opt/nginx/cert/www.codecoord.com.key;
# 下面的不用动
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.html; # 解决vue页面刷新404问题
}
}
}

© 版权声明

相关文章