Nginx开启https访问
来源:互联网 发布:机顶盒有必要买吗 知乎 编辑:程序博客网 时间:2024/05/16 10:04
创建ssl证书
#进入你想创建证书和私钥的目录cd /home/conf#创建服务器私钥openssl genrsa -des3 -out server.key 1024#创建签名请求的证书(CSR)openssl req -new -key server.key -out server.csr#在加载SSL支持的Nginx并使用上述私钥时除去必须的口令cp server.key server.key.orgopenssl rsa -in server.key.org -out server.key#生成证书openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
配置nginx
参考这里
server { listen 443; server_name ****.com;#域名 ssl_certificate /home/conf/server.crt;#证书路径(必要) ssl_certificate_key /home/conf/server.key;#key路径(必要) ssl_session_cache shared:SSL:1m; #s储存SSL会话的缓存类型和大小(可选) ssl_session_timeout 5m; #会话过期时间(可选) ssl_ciphers HIGH:!aNULL:!MD5; #为建立安全连接,服务器所允许的密码格式列表(可选) ssl_prefer_server_ciphers on; #依赖SSLv3和TLSv1协议的服务器密码将优先于客户端密码(可选) location / { root /var/www/; index index.html index.htm; }}
将http访问自动跳转到https
server{ listen 80; server_name ****.com;#域名 rewrite ^/(.*)$ https://****.com/$1 permanent;}
开启https访问端口
有时候服务器并没有打开443端口的访问权限,需要开放端口
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
阅读全文
0 0
- Nginx开启https访问
- nginx网站开启https访问,http自动跳转到https
- nginx下开启https
- afnetworking开启https访问
- tomcat开启https访问
- Nginx配置https访问
- apache和nginx开启https
- apache和nginx开启https
- apache和nginx开启https
- apache和nginx开启https
- apache和nginx开启https
- Apache和Nginx开启Https
- apache和nginx开启https
- Linux+Nginx/Apache/Tomcat新增SSL证书,开启https访问教程
- nginx使用ssl模块配置支持HTTPS访问 AND 开启gzip
- Linux+Nginx/Apache/Tomcat新增SSL证书,开启https访问教程
- nginx配置https,访问超时
- centos nginx配置https访问
- php实现无限级分类查询(递归、非递归)
- 笨方法学Python 习题 22: 到现在你学到了哪些东西?
- 2017杭电多校第一场02
- 大数据(四)Hadoop-HDFS zookeeper的安装
- 图论 用prim法求最小生成树
- Nginx开启https访问
- STL学习之十:map和multimap用法示例
- C++中的vector
- java泛型
- Microbiome:宏蛋白质组揭示健康人肠道菌群的功能,离真相更近了一步
- ubuntu命令和vim指令
- Dubbo教程(三)----一个简单的Dubbo示例
- 经典算法KMP
- gradient descent vs (mini-batch) stochastic gradient descent