源码安装nginx开启SSL功能
编译安装nginx的环境
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
下载nginx安装包
cd /usr/local/src
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar zxvf nginx-1.18.0.tar.gz
编译安装nginx
cd nginx-1.18.0
# 配置
./configure --prefix=/usr/local/nginx --with-http_ssl_module
# 编译,安装
make && make install
# 查询是否安装成功
/usr/local/nginx/sbin/nginx -V# 出现这个安装成功出现
nginx version: nginx/1.18.0
built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module
配置nginx.conf
# http自动跳转到https
server {listen 80;server_name localhost; #将localhost修改为您证书绑定的域名,例如:www.example.com。
rewrite ^(.*)$ https://$host$1 permanent; #将所有http请求通过rewrite重定向到https。location / {index index.html index.htm;}
}# ssl配置
server {listen 443 ssl;server_name localhost;root html;index index.html index.htm;ssl_certificate cert/domain name.pem; #将domain name.pem替换成您证书的文件名。ssl_certificate_key cert/domain name.key; #将domain name.key替换成您证书的密钥文件名。ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;location / {index index.html index.htm;}
}
Test
# http自动跳转到https
server {listen 80;server_name localhost; #将localhost修改为您证书绑定的域名,例如:www.example.com。
rewrite ^(.*)$ https://$host$1 permanent; #将所有http请求通过rewrite重定向到https。location / {index index.html index.htm;}
}# ssl配置
server {listen 443 ssl;server_name localhost;root html;index index.html index.htm;ssl_certificate /usr/local/nginx/cert/4329893_qra.psmtech.com.cn.pem; #将domain name.pem替换成您证书的文件名。ssl_certificate_key /usr/local/nginx/cert/4329893_qra.psmtech.com.cn.key; #将domain name.key替换成您证书的密钥文件名。ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;location / {index index.html index.htm;}
}
源码安装nginx开启SSL功能相关推荐
- nginx 源码安装并开启gzip静态压缩
前言 Nginx 使用 yum (Centos7) 在线安装方式无法开启 gzip 静态压缩,只能采用源码安装并开启 gzip 静态压缩(gzip_static). 安装下载工具 yum instal ...
- linux源码安装nginx
任务目标:源码安装nginx,作为web服务修改配置文件,让配置生效,验证配置 首先要去官网nginx.org下载一个tar包: tar xvf 解包 进入到解包出来的目录,对configure进行配 ...
- 源码安装nginx以及平滑升级
源码安装nginx以及平滑升级 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 欢迎加入:高级运维工程师之路 598432640 这个博客不方便上传软件包,我给大家把软件包放到百度云 ...
- linux access源码,从零开始学习Linux:Day04 源码安装Nginx 。acess/status/referer
从零开始学习Linux:Day04 源码安装Nginx .acess/status/referer 常见web服务器有IIS,apche,nginx,tomcat,tengine等等,现在nginx使 ...
- mysql安装 张宴_Linux_centos5 源码安装Nginx + mysql + apache + php的方法,主要依照的是张宴的一篇博文 - phpStudy...
centos5 源码安装Nginx + mysql + apache + php的方法 主要依照的是张宴的一篇博文<http://blog.s135.com/post/366/>,安装的软 ...
- 基于centos5.8源码安装nginx之LNMP
LNMP 指的是什么呢,这里可以"望文生义",其是linux NGINX Mysql PHP的组合.每一种工具的安装都有其特长来吸引我们去使用它,对此就要了解其组合的各个工具 ...
- 源码安装nginx 1.23.1
先看看仓库们 yum list nginx* 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile bas ...
- centos 上源码安装python3.7 ssl模块失败的问题
python 3.7安装完毕后,提示找不到ssl模块. 编译python时抛出问题如下,并且import ssl失败,无法使用pip在线安装: ---------------------------- ...
- 测试CSDN的博客功能好不好用——YUM安装Nginx或源码安装Nginx
yum安装 # 安装openssl1.0.2只需要使用Ali的base库,如下 [root@CentOs1612 /etc]# cat <<EOF > /etc/yum.repos. ...
最新文章
- You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法
- 索尼AI CEO:我们要让AI在30年内拿到诺贝尔奖
- python---webRTC~vad静音检测-学习笔记
- 可编程ic卡 通用吗_8255可编程IC
- 在两个ASP.NET页面之间传递值
- python可以用del释放资源_Python中垃圾回收和del语句详解
- Mac用brew安装mysql
- Vulnerable Javascript library
- 手机麦克风结构原理图_一文看懂咪头的工作原理及结构(驻极体话筒) - 全文...
- win7 64位系统epson LQ630k 不打印的问题解决方法
- swagger注解的使用
- 远程控制软件app有哪些?
- HTML5基础(五)零基础入门 (上)
- 统计给定字符串中各字符的个数
- Java基础综合练习案例
- 微信小程序文字换行符
- go语言web开发系列之五:gin用zap+file-rotatelogs实现日志记录及按日期切分日志
- MySQL 建库和建表
- 安卓 camera api 2实现视频流录像加视频调阅
- 微信小程序版本和发布
热门文章
- 使用 conda 和 Jupyter 在 R 中实现数据科学分析
- gffread处理工具
- ​Nature子刊:中德合作发现玉米根系与根际有益微生物互惠关键生物学机制
- 想知道自己能不能长命百岁?窝个粑粑测个菌?
- html实现上下层效果图,Css布局系列-上下两栏应用场景_html/css_WEB-ITnose
- python使用matplotlib可视化线图(line plot)、并自定义设置可视化图像线条的类型(specify the line style of a plot in matplotlib)
- R语言ggplot2可视化:箱图(box plot)可视化并且在为箱图的异常值(outlier)添加数据标签
- R语言ggplot2可视化条形图可视化控制底部和x轴之间没有空格实战:即条形图的底部直接和坐标轴连接
- 分类模型的ROC曲线、AUC值、GINI系数、Lift、Gain、KS指标分别是什么?计算公式是什么?有什么意义?
- 为什么需要权重初始化(weight initialization)?常见的权重初始化方式有哪些?启发式权重初始化的好处?