原文网址:https://www.youyong.top/article/1158e70ec1110
本文介绍在云服务器 ECS CentOS 6.5 服务器上安装配置 nginx 的 https 服务。 https 需要安装 openssl 软件。
原文网址:https://www.youyong.top/article/1158e70ec1110
本文介绍在云服务器 ECS CentOS 6.5 服务器上安装配置 nginx 的 https 服务。 https 需要安装 openssl 软件。
原文网址:https://www.youyong.top/article/1158e70ec1110
本文的实验环境:
1. 在配置 nginx 时,可能会依赖于 PCRE 包和 zlib 包,先进行安装:
# yum -y install pcre pcre-devel
# yum install -y zlib-devel
2. 下载 nginx
# wget http://nginx.org/download/nginx-1.6.2.tar.gz
3. 解压缩
# tar -xvzf nginx-1.6.2.tar.gz
4. 配置nginx
# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-openssl=/usr/local/openssl-0.9.8zg
注意: 这里 /usr/local/openssl-0.9.8zg 指的的是 openssl 的源码包,不是编译安装好的 openssl, 否则在执行 make 时会出错。
# make
# make install
5. 使用 openssl 生成证书
# openssl req -new -x509 -nodes -out server.crt -keyout server.key
生成证书时,请根据自己的需要填写信息:
6. 修改 nginx 配置文件:
# vi /usr/local/nginx/conf/nginx.conf
添加如下内容:
server {
listen 443 ssl;
server_name localhost;
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
7. 启动 nginx:
# /usr/local/nginx/sbin/nginx
8. http方式访问测试示意:
9. https 方式访问示意:
至此nginx配置https就完成了。
共 0 条留言
别的域名也能访问我的网站是怎么回事?|Linux下nginx如何禁止空主机头?| 网站IP被恶意解析
Nginx启动报错:Error open() nginx.pid?
阿里云·业务运营团队内部的前端构建和工程化工具 Dawn开源
nginx 报错: emerg bind to 80 failed 98 address already in use
nginx warn upstream response is buffered to a temporary file
iPhone X 跌破发行价,苏宁200亿入股恒大 | 财经日日评
资深黄牛现身说法:iPhone X价格秒变不停,就像炒股一样
手机扫一扫
分享文章