nginx + PHP 下 https的设置。
来源:互联网 发布:python做搜索引擎 编辑:程序博客网 时间:2024/06/08 22:29
openssl genrsa -des3 -out server.key 2048
输入密码即可。
2. 创建 csr
openssl req -new -key engir.key -out server.csr
按流程填写,如
Country Name (2 letter code) [GB]: JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:Bunkyo-ku
Organization Name (eg, company) [My Company Ltd]: HuaWei
Organizational Unit Name (eg, section) :ENGR
Common Name (eg, your name or your server's hostname) []:abc.com
Email Address []:info@it.co.jp 注意邮件地址要和注册域名时的邮件地址一样
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: 回车
An optional company name []: 回车
3. 通过 server.key server.csr 在相应的网站申请 证书
如: http://www.startssl.com/
http://ocsp.godaddy.com/
申请成功后会得到两个文件:
gd_bundle.crt abc.com.crt
4. 设置nginx的配置
上传 gd_bundle.crt abc.com.crt 文件至 nginx的配置目录下 /usr/local/nginx/conf
执行
cat abc.com.crt gd_bundle.crt > abc.com.chained.crt
Nginx的配置如下:
server {
listen 443;
server_name ttt.e.com;
ssl on;
ssl_certificate /usr/local/nginx/conf/abc.com.chained.crt;
ssl_certificate_key /usr/local/nginx/conf/abc.com.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root html;
index index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi.conf;
}
}
5. 验证
执行
openssl s_client -connect www.godaddy.com:443
最后访问 https://abc.com 如果能看到证书的信息,而且连接都正常就OK了。
注意:
安装nginx 时要加上https模块,编译时:
./configure --with-http_sub_module --with-http_ssl_module
可以用 /usr/local/nginx/sbin/nginx -V 来查看。
设置完密码后,重启nginx需要输入密码,想让不用输入密码 执行 openssl rsa -in server.key -out server.key
一个nginx 上只能放一个https 的服务,否则会出错。
- nginx + PHP 下 https的设置。
- nginx + PHP 下 添加 https 的支持
- nginx+php 环境下的https环境搭建
- Nginx下的https配置
- Nginx下只针对logging.php进行https处理的重写规则 【转】
- Nginx下只针对logging.php进行https处理的重写规则 【转】
- Nginx下的项目 http转https
- CentOS下Nginx的HTTPS配置
- nginx+php下curl请求https报502错
- nginx下开启https
- nginx下配置https
- 2.nginx学习笔记:nginx下的https配置
- nginx设置http跳转https
- Nginx+php-fpm SSL不输出$_SERVER['HTTPS']的解决办法
- 【nginx+PHP】nignx下php的配置
- Ubuntu下配置Nginx HTTPS
- nginx下http转https
- windwos下Nginx配置https
- C#访问PostGreSQL数据库
- Linux下的多进程编程初步
- 1716. Houses (邻接矩阵)
- IE8下struts2 采用ajax提交表单,返回json字符串,解析不了,直接保存json字符串。提示下载action.
- 温故知新 javascript 正则表达式
- nginx + PHP 下 https的设置。
- 杭电 1384 差分约束
- 物联网感知层的IPv6协议标准化动态
- 界面设计的哲学思考
- AIR版的通讯簿(六)
- 我我我我我我我我我我我我我我我我v
- AIR版的通讯簿(七)
- 判断的哲学思考
- stm32 JTAG做普通io口(来自www.ourdev.com)