建站服务器
实例1:为已安装nginx动态添加模块
以安装rtmp媒流模块为例:
1)下载第三方模块到
[root@lnmp nginx-1.8.1]# git clone https://github.com/arut/nginx-rtmp-module.git
2)查看nginx编译安装时安装的模块
[root@lnmpnginx-1.8.1]#nginx-vnginxversion:nginx/1.8.1builtbygcc4.4.720120313(redhat4.4.7-18)(gcc)builtwithopenssl1.0.1e-fips11feb2013tlssnisupportenabledconfigurearguments:--user=nginx--group=nginx--prefix=/usr/local/nginx--with-http_ssl_module--with-http_stub_status_module--with-http_ssl_module3)cd到源码目录添加模块重新配置编译
[root@lnmpnginx]#cd/root/tools/nginx-1.8.1[root@lnmpnginx-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@lnmpnginx-1.8.1]#make#此处只进行编译不进行安装,如安装的话会覆盖源文件。
4)在编译完成后,会在当前目录下生成一个objs文件夹,将nginx二进制文件拷贝到源安装目录下,注意备份源文件,然后查看编译后的模块。
[root@lnmpnginx-1.8.1]#mv/usr/local/nginx/sbin/nginx/usr/local/nginx/sbin/nginx.20170825[root@lnmpnginx-1.8.1]#cpobjs/nginx/usr/local/nginx/sbin/nginx[root@lnmpnginx-1.8.1]#nginx-vnginxversion:nginx/1.8.1builtbygcc4.4.720120313(redhat4.4.7-18)(gcc)builtwithopenssl1.0.1e-fips11feb2013tlssnisupportenabledconfigurearguments:--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@lnmpnginx-1.8.1]#nginx-sreload
实例2:nginx使用ssl模块配置https支持
1、生成证书(注意此证书为自己颁发的在公网上不受信任)
1)生成一个rsa密钥:
[root@lnmpssl]#opensslgenrsa-des3-outtest.key1024generatingrsaprivatekey,1024bitlongmodulus.............................. ........................... eis65537(0x10001)enterpassphrasefortest.key:#输入密码,需要复杂性要求verifying-enterpassphrasefortest.key:#重复密码2)拷贝刚才的密码文件,生成一个不需要密码的密钥文件:
[root@lnmpssl]#opensslrsa-intest.key-outtest_nopass.keyenterpassphrasefortest.key:#输入以上创建时输入的密码writingrsakey3)生成一个证书请求文件
[root@lnmpssl]#opensslreq-new-keytest.key-outtest.csrenterpassphrasefortest.key:#输入以上创建时输入的密码youareabouttobeaskedtoenterinformationthatwillbeincorporatedintoyourcertificaterequest.whatyouareabouttoenteriswhatiscalledadistinguishednameoradn.therearequiteafewfieldsbutyoucanleavesomeblankforsomefieldstherewillbeadefaultvalue,ifyouenter\\\'.\\\',thefieldwillbeleftblank.-----countryname(2lettercode)[xx]:cn#国家stateorprovincename(fullname)[]:shanghai#省份localityname(eg,city)[defaultcity]:shanghai#城市organizationname(eg,company)[defaultcompanyltd]:shanghaiinformationcompanyltd#具体名称organizationalunitname(eg,section)[]:test#单位名称commonname(eg,yournameoryourserver\\\'\\\'shostname)[]:*.test.cn#服务器域名emailaddress[]:admin@test.cn#邮箱pleaseenterthefollowing\\\'extra\\\'attributestobesentwithyourcertificaterequestachallengepassword[]:#密码为空,直接回车anoptionalcompanyname[]:#密码为空,直接回车4)自己签发证书
[root@lnmpssl]#opensslx509-req-days365-intest.csr-signkeytest.key-outtest.crtsignatureoksubject=/c=cn/st=shanghai/l=shanghai/o=shanghaiinformationcompanyltd/ou=test/cn=*.test.cn/emailaddress=admin@test.cngettingprivatekeyenterpassphrasefortest.key:#输入test.key设置的密码
2、配置nginx.conf文件
[root@lnmpssl]#vim/usr/local/nginx/conf/nginx.conf添加如下:server{listen80;server_namelocalhost;listen443;#监听端口sslon;#开启sslssl_certificate/usr/local/nginx/conf/test.crt;#指定证书位置ssl_certificate_key/usr/local/nginx/conf/test_nopass.key;#指定密钥文件,如此处使用test.key则每次启动nginx服务器需要舒服key密码。[root@lnmpssl]#nginx-sreload#重加载配置———————————–end—————————————————–
什么是top域名 top域名开放注册日期服务器云主机和虚拟空间哪个好腾讯云服务器怎么管理后台企业级云服务器配置多少钱华为hecs云服务器怎么样电脑任务管理器无法启动运行的解决方法【图文】开个微店需要多少钱?开个微店需要的费用是多少?顺便把云锁给我卸载了不用那个