nginx 配置https访问以及访问http跳转到https
2017-11-03 11:19
661 查看
nginx 配置https访问以及访问http跳转到https
1.配置https访问步骤:1. ssl的证书我是在腾讯云上面免费申请的,按照步骤申请也五分钟的事,申请成功后,将证书下载到本地
2. 解压压缩包,将其中的nginx中的两个文件(.crt和.key文件类型)发送到服务器上(上传位置:建议在nginx/conf/),新建文件夹sslfile,上传到此位置
3. 使用编辑器 编辑nginx.conf文件
4. 配置https访问
server{ listen 443;#修改为443端口 #listen 80; ssl on;#添加ssl on ssl_certificate sslfile/xxxx.crt;#添加 ssl_certificate_key sslfile/xxxx.key;#添加 ssl_session_timeout 5m;#添加 }
最后 保存配置,输入 nginx -t 检查配置文件 nginx -s reload 重新加载配置文件
2.配置http跳转https访问步骤:
在上述基础上,重新添加以下配置’
server{ listen 80; server_name *.域名; rewrite ^(.*) https://$host$1 permanent; }
最后 保存配置,输入 nginx -t 检查配置文件 nginx -s reload 重新加载配置文件
记录一下
相关文章推荐
- nginx证书制作以及配置https并设置访问http自动跳转https(反向代理转发jboss)
- 【环境配置】申请StartSSL免费CA证书,配置Nginx使用https访问,强制http跳转到https
- Nginx-配置https虚拟服务(访问http时自动跳转https)
- Nginx的https配置记录以及http强制跳转到https的方法梳理
- nginx配置http访问自动跳转到https
- Nginx的https配置记录以及http强制跳转到https的方法梳理
- Nginx配置http强制跳转到https
- 什么是ssl证书,什么是https,nginx如何配置ssl证书,兼容https与http同时访问站点
- nginx访问http80端口跳转https443端口
- nginx 强制使用https访问(http跳转到https)
- Tomcat配置https及访问http自动跳转至https
- nginx强制使用https访问(http跳转到https
- 【Tomcat】配置https及访问http自动跳转至https
- nginx强制使用https访问 http跳转到https
- Tomcat配置HTTPS及访问HTTP自动跳转到HTTPS
- nginx强制使用https访问(http跳转到https)
- 配置Nginx网站https访问、http共存访问
- nginx强制使用https访问(http跳转到https)
- nginx配置http跳转https
- Tomcat配置https并访问http自动跳转至https