In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Example 1: Dynamically adding modules to installed nginx
Take installing the rtmp media stream module as an example:
1)Download third-party modules to
[root@LNMP nginx-1.8.1]# git clone https://github.com/arut/nginx-rtmp-module.git
2)View modules installed during nginx build installation
[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 to source directory add module reconfigure compile
[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
#Here only compile without installation, if installed, it will overwrite the source file.
4)After compilation, an objs folder will be generated in the current directory, copy the nginx binary file to the source installation directory, pay attention to backing up the source file, and then view the compiled module.
[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
Example 2: nginx uses ssl module to configure https support
1. Generate a certificate (note that this certificate is not trusted on the public network)
1)Generate an RSA key:
[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: #Verify- Enter pass phrase for test.key: #Repeat password
2)Copy the password file just now and generate a key file that does not require a password:
[root@LNMP ssl]# openssl rsa -in test.key -out test_nopass.keyEnter pass phrase for test.key: #Enter password entered when creating above writing RSA key
3)Generate a certificate request file
[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 incorporated into your certificate request.What you are about to enter is what is called a Distinguished Name or a DN. If you enter '. ', the field will be left blank.----- Country Name (2 letter code) [XX]:cn #CountryState or Province Name (full name) []:shanghai #provincialLocality Name (eg, city) [Default City]:shanghai #市Organization Name (eg, company) [Default Company Ltd]:shanghai information company Ltd #Specific Name Organizational Unit Name (eg, section) []:test #Unit Name Common Name (eg, your name or your server's hostname) []:*. test.cn #Server Domain Email Address []: admin@test.cn #Mailbox Please enter the following 'extra' attributeto be sent with your certificate requestA challenge password []: #Password is empty, enter directly An optional company name []: #Password is empty, enter directly
4)Self-issued certificate
[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: #Enter test.key Set secret code
2. Configure the nginx.conf file
[root@LNMP ssl]# vim /usr/local/nginx/conf/nginx.conf Add the following: server { listen 80; server_name localhost; listen 443; #Listening port ssl on; #Open ssl ssl_certificate/usr/local/nginx/conf/test.crt; #Specify the certificate location ssl_certificate_key /usr/local/nginx/conf/test_nopass.key; #Specify the key file, so test.key is used here to require a comfortable key password each time the nginx server is started. [root@LNMP ssl]# nginx -s reload
-----------------------------------end-----------------------------------------------------
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.