nginx ssl免密码重启教程详解
2017-01-13 15:10
316 查看
一、nginx如何启动
1、HTTP和HTTPS的区别
https协议需要到ca申请证书,一般免费证书很少,需要交费。
http是超文本传输协议,信息是明文传输,https 则是具有安全性的ssl加密传输协议。
http和https使用的是完全不同的连接方式,用的端口也不一样,前者是80,后者是443。
http的连接很简单,是无状态的;HTTPS协议是由SSL+HTTP协议构建的可进行加密传输、身份认证的网络协议,比http协议安全。
所以在涉及到账户、金钱等敏感信息交互的时候使用HTTPS是个不错的选择。
2、申请证书
申请SSL证书过程就不多说了。挺简单的,本文主要是在nginx上配置ssl证书实现https访问。
将key和证书上传到服务器。
3、nginx配置
代码如下
server { listen 443; #listen [::]:80; server_name passport.ddhigh.com; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/passport.ddhigh.com; include other.conf; #error_page 404 /404.html; location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } ssl on; ssl_certificate /root/crt/server.crt; ssl_certificate_key /root/crt/server.key; access_log /home/wwwlogs/passport.ddhigh.com.log access; }
/root/crt是我的证书目录,各位读者可以根据实际情况更改。
二、nginx ssl 免密码重启
设置ssl之后每次重启nginx都需要手动输入证书密码,非常麻烦,一旦输出就要重来。
利用openssl可以将有密码的私钥转化为免密码的私钥。
openssl rsa -in server.key -out server.key.nopassword
nginx配置ssl的时候将server.key的路径配置为server.key.nopassword的路径即可。
以上所述是小编给大家介绍的nginx ssl免密码重启教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:
相关文章推荐
- 去除apache/lighttpd/nginx SSL重启密码
- 网站启用SSL后重启Nginx提示 Enter PEM Pass Phrase:需要输入密码
- 去除apache/lighttpd/nginx SSL重启密码
- 去除apache/lighttpd/nginx SSL重启密码
- Nginx启动/重启脚本详解
- web服务器nginx的启动、停止、重启、升级操作命令详解
- Nginx的安装SSL基本教程
- Nginx的安装SSL基本教程
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- Linux下nginx编译安装教程和编译参数详解
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- Nginx+SSL+Node.js运行环境配置教程
- Nginx 配置 SSL 证书 + 搭建 HTTPS 网站教程
- Tomcat详解:实现SSL配置,日志配置,登陆用户名与密码设置,路径列表
- wdcp(nginx)平滑升级到Tengine 教程!无须重启
- nginx tomcat集群配置实现无痛重启服务教程python语言版本
- NGINX当中的SSL配置(PEM启动密码免输入)
- Nginx服务器中关于SSL的安全配置详解
- 详解 Nginx + Tomcat HTTPS/SSL 配置
- Win8系统开机密码怎么取消 Win8电脑开机加速教程详解