编译安装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功能相关推荐

  1. nginx 源码安装并开启gzip静态压缩

    前言 Nginx 使用 yum (Centos7) 在线安装方式无法开启 gzip 静态压缩,只能采用源码安装并开启 gzip 静态压缩(gzip_static). 安装下载工具 yum instal ...

  2. linux源码安装nginx

    任务目标:源码安装nginx,作为web服务修改配置文件,让配置生效,验证配置 首先要去官网nginx.org下载一个tar包: tar xvf 解包 进入到解包出来的目录,对configure进行配 ...

  3. 源码安装nginx以及平滑升级

    源码安装nginx以及平滑升级 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 欢迎加入:高级运维工程师之路 598432640 这个博客不方便上传软件包,我给大家把软件包放到百度云 ...

  4. linux access源码,从零开始学习Linux:Day04 源码安装Nginx 。acess/status/referer

    从零开始学习Linux:Day04 源码安装Nginx .acess/status/referer 常见web服务器有IIS,apche,nginx,tomcat,tengine等等,现在nginx使 ...

  5. mysql安装 张宴_Linux_centos5 源码安装Nginx + mysql + apache + php的方法,主要依照的是张宴的一篇博文 - phpStudy...

    centos5 源码安装Nginx + mysql + apache + php的方法 主要依照的是张宴的一篇博文<http://blog.s135.com/post/366/>,安装的软 ...

  6. 基于centos5.8源码安装nginx之LNMP

    LNMP 指的是什么呢,这里可以"望文生义",其是linux  NGINX  Mysql  PHP的组合.每一种工具的安装都有其特长来吸引我们去使用它,对此就要了解其组合的各个工具 ...

  7. 源码安装nginx 1.23.1

    先看看仓库们 yum list nginx* 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile bas ...

  8. centos 上源码安装python3.7 ssl模块失败的问题

    python 3.7安装完毕后,提示找不到ssl模块. 编译python时抛出问题如下,并且import ssl失败,无法使用pip在线安装: ---------------------------- ...

  9. 测试CSDN的博客功能好不好用——YUM安装Nginx或源码安装Nginx

    yum安装 # 安装openssl1.0.2只需要使用Ali的base库,如下 [root@CentOs1612 /etc]# cat <<EOF > /etc/yum.repos. ...

最新文章

  1. You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法
  2. 索尼AI CEO:我们要让AI在30年内拿到诺贝尔奖
  3. python---webRTC~vad静音检测-学习笔记
  4. 可编程ic卡 通用吗_8255可编程IC
  5. 在两个ASP.NET页面之间传递值
  6. python可以用del释放资源_Python中垃圾回收和del语句详解
  7. Mac用brew安装mysql
  8. Vulnerable Javascript library
  9. 手机麦克风结构原理图_一文看懂咪头的工作原理及结构(驻极体话筒) - 全文...
  10. win7 64位系统epson LQ630k 不打印的问题解决方法
  11. swagger注解的使用
  12. 远程控制软件app有哪些?
  13. HTML5基础(五)零基础入门 (上)
  14. 统计给定字符串中各字符的个数
  15. Java基础综合练习案例
  16. 微信小程序文字换行符
  17. go语言web开发系列之五:gin用zap+file-rotatelogs实现日志记录及按日期切分日志
  18. MySQL 建库和建表
  19. 安卓 camera api 2实现视频流录像加视频调阅
  20. 微信小程序版本和发布

热门文章

  1. 使用 conda 和 Jupyter 在 R 中实现数据科学分析
  2. gffread处理工具
  3. ​Nature子刊:中德合作发现玉米根系与根际有益微生物互惠关键生物学机制
  4. 想知道自己能不能长命百岁?窝个粑粑测个菌?
  5. html实现上下层效果图,Css布局系列-上下两栏应用场景_html/css_WEB-ITnose
  6. python使用matplotlib可视化线图(line plot)、并自定义设置可视化图像线条的类型(specify the line style of a plot in matplotlib)
  7. R语言ggplot2可视化:箱图(box plot)可视化并且在为箱图的异常值(outlier)添加数据标签
  8. R语言ggplot2可视化条形图可视化控制底部和x轴之间没有空格实战:即条形图的底部直接和坐标轴连接
  9. 分类模型的ROC曲线、AUC值、GINI系数、Lift、Gain、KS指标分别是什么?计算公式是什么?有什么意义?
  10. 为什么需要权重初始化(weight initialization)?常见的权重初始化方式有哪些?启发式权重初始化的好处?