nginx添加模块与https支持
发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,实例1:为已安装nginx动态添加模块以安装rtmp媒流模块为例:1)下载第三方模块到[root@LNMP nginx-1.8.1]# git clone https://github.com/aru
千家信息网最后更新 2025年02月02日nginx添加模块与https支持
实例1:为已安装nginx动态添加模块
以安装rtmp媒流模块为例:
1)下载第三方模块到
[root@LNMP nginx-1.8.1]# git clone https://github.com/arut/nginx-rtmp-module.git
2)查看nginx编译安装时安装的模块
[root@LNMP nginx-1.8.1]# nginx -Vnginx version: nginx/1.8.1built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013TLS SNI support enabledconfigure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_ssl_module
3)cd到源码目录添加模块重新配置编译
[root@LNMP nginx]# cd /root/tools/nginx-1.8.1[root@LNMP nginx-1.8.1]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_ssl_module --add-module=/root/tools/nginx-1.8.1/nginx-rtmp-module
[root@LNMP nginx-1.8.1]# make
#此处只进行编译不进行安装,如安装的话会覆盖源文件。
4)在编译完成后,会在当前目录下生成一个objs文件夹,将nginx二进制文件拷贝到源安装目录下,注意备份源文件,然后查看编译后的模块。
[root@LNMP nginx-1.8.1]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.20170825[root@LNMP nginx-1.8.1]# cp objs/nginx /usr/local/nginx/sbin/nginx[root@LNMP nginx-1.8.1]# nginx -Vnginx version: nginx/1.8.1built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013TLS SNI support enabledconfigure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_ssl_module --add-module=/root/tools/nginx-1.8.1/nginx-rtmp-module[root@LNMP nginx-1.8.1]# nginx -s reload
实例2:nginx使用ssl模块配置https支持
1、生成证书(注意此证书为自己颁发的在公网上不受信任)
1)生成一个rsa密钥:
[root@LNMP ssl]# openssl genrsa -des3 -out test.key 1024Generating RSA private key, 1024 bit long modulus..............................++++++...........................++++++e is 65537 (0x10001)Enter pass phrase for test.key: #输入密码,需要复杂性要求Verifying - Enter pass phrase for test.key: #重复密码
2)拷贝刚才的密码文件,生成一个不需要密码的密钥文件:
[root@LNMP ssl]# openssl rsa -in test.key -out test_nopass.keyEnter pass phrase for test.key: #输入以上创建时输入的密码writing RSA key
3)生成一个证书请求文件
[root@LNMP ssl]# openssl req -new -key test.key -out test.csrEnter pass phrase for test.key: #输入以上创建时输入的密码You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:cn #国家State or Province Name (full name) []:shanghai #省份Locality Name (eg, city) [Default City]:shanghai #城市Organization Name (eg, company) [Default Company Ltd]:shanghai information company Ltd #具体名称Organizational Unit Name (eg, section) []:test #单位名称Common Name (eg, your name or your server''s hostname) []:*.test.cn #服务器域名Email Address []:admin@test.cn #邮箱Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []: #密码为空,直接回车An optional company name []: #密码为空,直接回车
4)自己签发证书
[root@LNMP ssl]# openssl x509 -req -days 365 -in test.csr -signkey test.key -out test.crtSignature oksubject=/C=cn/ST=shanghai/L=shanghai/O=shanghai information company Ltd/OU=test/CN=*.test.cn/emailAddress=admin@test.cnGetting Private keyEnter pass phrase for test.key: #输入test.key设置的密码
2、配置nginx.conf文件
[root@LNMP ssl]# vim /usr/local/nginx/conf/nginx.conf添加如下:server { listen 80; server_name localhost; listen 443; #监听端口 ssl on; #开启ssl ssl_certificate /usr/local/nginx/conf/test.crt; #指定证书位置 ssl_certificate_key /usr/local/nginx/conf/test_nopass.key; #指定密钥文件,如此处使用test.key则每次启动nginx服务器需要舒服key密码。
[root@LNMP ssl]# nginx -s reload #重加载配置
-----------------------------------end-----------------------------------------------------
密码
模块
文件
输入
证书
生成
编译
配置
密钥
目录
名称
实例
拷贝
服务器
源文件
服务
支持
复杂
舒服
二进制
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
温州计算机网络技术学院
三亚众合天辉互联网科技有限公司
万有网络技术
通信网络技术学习心得总结
boot读取数据库接口
自控软件开发
了解软件开发与测试
nas做软件服务器
攻击游戏服务器工具
良友软件开发培训学校
沈阳物流软件开发公司哪家好
独立服务器价格对比
有关网络安全主题的漫画
冗余数据库是啥意思
彩虹基因数据库
小学网络安全活动方案
互联网最新科技成果发布
安装游戏时显示无法连接服务器
小嘉网络技术服务部官方账号
江苏软件开发者网站
战地三服务器下载
环境监测数据的数据库类型
网络安全sase
网络安全培训方案供应商
学校网络安全监管制度
水务局网络安全应急处置预案
HS6出口技术复杂度数据库
云南农信服务器云空间
远程服务器内虚拟机
光纤一般接在服务器什么口上