Centos下nginx支持https协议
1、首先配置nginx及其他插件,这个Google下,很多配置方案。
2、配置服务器的证书。操作步骤如下:
[root@localhost ~]# cd /etc/pki/tls/certs
[root@localhost certs]# make server.key
umask ; \
/usr/bin/openssl genrsa -aes128 > server.key
Generating RSA private key, bit long modulus
......................................................++++++
.............++++++
e is (0x10001)
Enter pass phrase:# set passphrase
Verifying - Enter pass phrase:# confirm
# remove passphrase from private key
[root@localhost certs]# openssl rsa -in server.key -out server.key
Enter pass phrase for server.key:# input passphrase
writing RSA key
[root@localhost certs]#
[root@localhost certs]# make server.csr
umask ; \
/usr/bin/openssl req -utf8 -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name ( letter code) [XX]:CN #country
State or Province Name (full name) [e]:Beijing #state
Locality Name (eg, city) [Default City]:Beijing #city
Organization Name (eg, company) [Default Company Ltd]:Test #company
Organizational Unit Name (eg, section) []:Test Haha #department
Common Name (eg, your server's hostname) []:www.test.com #server's FQDN
Email Address []:admin@test.com # email address
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:# Enter
An optional company name []:# Enter
[root@localhost certs]#
[root@localhost certs]# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days
Signature ok
subject=/C=CN/ST=Beijing/L=Beijing/O=Test/OU=Test Haha/CN=www.test.com,/emailAddress=admin@test.com
Getting Private key
[root@localhost certs]# chmod server.*
3、配置nginx的conf文件
我测试机器的nginx是安装在 /data/server/nginx目录下,配置文件在 /data/server/nginx/conf/目录下。
[root@localhost conf]# vi nginx.conf
ssl部分的配置如下
server {
#listen ;
listen default_server;
listen ssl;
server_name localhost; ssl_certificate /etc/pki/tls/certs/server.crt;
ssl_certificate_key /etc/pki/tls/certs/server.key;
#charset koi8-r;
重新加载配置文件。
4、打开Centos自带iptables的443端口
[root@localhost conf]# vi /etc/sysconfig/iptables
增加一行
-A INPUT -p tcp -m state --state NEW -m tcp --dport -j ACCEPT
重启iptables服务。
Centos下nginx支持https协议的更多相关文章
- 【转】Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- centos7.3下curl支持https协议
1 由于自己的curl是默认安装的,查看了下 不支持https协议 [root@izwz90bp6do7s3cr45cw6az ~]# curl --version curl (x86_64-redh ...
- Linux下nginx配置https协议访问
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- CentOS6.5 下在Nginx中添加SSL证书以支持HTTPS协议访问
参考文献: 1. NginxV1.8.0安装与配置 2. CentOS下在Nginx中添加SSL证书以支持HTTPS协议访问 3. nginx配置ssl证书的方法 4.nginx强制使用https访问 ...
- Nginx配置支持https协议-应用实践
Nginx配置支持https协议-应用实践 https简介 HTTPS 是运行在 TLS/SSL 之上的 HTTP,与普通的 HTTP 相比,在数据传输的安全性上有很大的提升. TLS是传输层安全协议 ...
- Python内置的urllib模块不支持https协议的解决办法
Django站点使用django_cas接入SSO(单点登录系统),配置完成后登录,抛出“urlopen error unknown url type: https”异常.寻根朔源发现是python内 ...
- 1、大部分社交平台接口不支持https协议。
参考文献来自:http://wiki.mob.com/ios9-%E5%AF%B9sharesdk%E7%9A%84%E5%BD%B1%E5%93%8D%EF%BC%88%E9%80%82%E9%85 ...
- Nginx - Windows下Nginx初入门,附CentOS下Nginx的安装
公司刚使用nginx,预先学习下.鉴于机器没有Linux环境,在Windows熟悉下. 下载 目前(2015-07-11),nginx的稳定版本是1.8.0,在官网下载先,windows版的nginx ...
随机推荐
- LeetCode OJ:Maximum Product Subarray(子数组最大乘积)
Find the contiguous subarray within an array (containing at least one number) which has the largest ...
- 旧书重温:0day2【11】第6章 狙击windows的异常处理
昨晚经过一番努力,又把第六章的内容温习了一遍! 随手,做了一个实验!狙击windows的异常处理, 顺便也把过程记录了下来!省事!(有图) 今早,论坛一直无法打开! 就推迟到了现在! 哈哈 正题: 第 ...
- 西交利物浦大学Java PAPER CODE: CSE105/12-13/S1/Resit Coursework
Question 6:What is an accessor method?What is a mutator method? 答案参考:http://www.xmsydw.com Number An ...
- 关于this指向问题的总结【转自秘密花园】
this 的工作原理 JavaScript 有一套完全不同于其它语言的对 this 的处理机制. 在五种不同的情况下 ,this 指向的各不相同. 第一种:全局范围内 this; 当在全部范围内使用 ...
- 判定客户端IP所在的省市[2]
在上一篇地址控件的基础上,添加了判定客户端IP所在省市的功能. 调用新浪提供的IP库接口:http://counter.sina.com.cn/ip/,(可直接点击链接查看返回的数据) 126提供的接 ...
- 2017-2018-2 20179215《网络攻防实践》seed缓冲区溢出实验
seed缓冲区溢出实验 有漏洞的程序: /* stack.c */ /* This program has a buffer overflow vulnerability. */ /* Our tas ...
- 《DSP using MATLAB》示例Example7.20
代码: M = 51; alpha = (M-1)/2; Dw = 2*pi/M; l = 0:M-1; wl = Dw*l; T1 = j*0.39; k1 = 0:floor((M-1)/2); ...
- 给UIButton设置阴影及动画组
//设置“开启旅程”按钮 UIButton *startBtn = self.startBtn; CGFloat btnW = ; CGFloat btnH = ; CGFloat btnX = (s ...
- XML的应用 ---- 从一个范例看xml数据、xsd验证、xslt样式
从一个范例看XML的应用 引言 如果你已经看了Asp.Net Ajax的两种基本开发模式 这篇文章,你可能很快会发现这样一个问题:在那篇文章的方式2中,客户端仅仅是发送了页面上一个文本框的内容到服务端 ...
- RESTful处理JSON
@RequestMapping(value = "/dblist", method = RequestMethod.GET) @ResponseBody public Map< ...