First step: Download the corresponding version from http://nginx.org/download/(or wget http://nginx.org/download/nginx-1.5.9.tar.gz directly on Linux)
Step two: Unzip TAR-ZXVF nginx-1.5.9.tar.gz
Step three: Set the configuration information./configure--prefix=/usr/local/nginx, or do not perform this step, direct default configuration
Fourth Step:
Make compile (making is the process of writing source files in various languages into executables and various library files)
Make install installation (made install to copy these compiled executables and library files to the appropriate place)
At the time of configuration information, in the third step, there was an error:
The error is:./configure:error:the HTTP Rewrite module requires the PCRE library.
Installing Pcre-devel to solve problems
Yum-y Install Pcre-devel
There is also the possibility of:
Error message:./configure:error:the HTTP Cache module requires MD5 functions
From the OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with Nginx by using
--with-http_ssl_module--with-openssl=<path> Options.
Workaround:
Yum-y Install OpenSSL Openssl-devel
After installation, start and close Nginx under Linux:
Start action
/usr/nginx/sbin/nginx (/usr/nginx/sbin/nginx-t See if the configuration information is correct)
Stop operation
The stop operation is done by sending a signal to the nginx process (see the Linux article for a signal)
Step 1: Query the Nginx main process number
Ps-ef | grep nginx
Find the master process in the list of processes, whose number is the main process number.
Step 2: Send a signal
Calmly stop Nginx:
Kill-quit Main process Number
Quick Stop Nginx:
Kill-term Main process Number
Force Stop Nginx:
Pkill-9 Nginx
In addition, if the nginx.conf configuration of the PID file storage path, the file is stored in the Nginx main process number, if not specified in the Nginx logs directory. With the PID file, we do not have to query the Nginx main process number, and directly to the nginx sent a signal, the command is as follows:
Kill-Signal type '/usr/nginx/logs/nginx.pid '
Smooth Restart
If you change the configuration to restart Nginx, you need to turn off the nginx before opening? No, can send a signal to nginx, smooth restart.
Smooth Restart command:
Kill-hup live in title or process number file path
or use
/usr/nginx/sbin/nginx-s Reload
Note that after modifying the configuration file, it is best to check the correct configuration file, so as not to restart after the Nginx error affecting the stable operation of the server. Determine if the Nginx configuration is the correct command as follows:
Nginx-t-c/usr/nginx/conf/nginx.conf
Or
/USR/NGINX/SBIN/NGINX-T: Transfer from: http://www.cnblogs.com/kunhu/p/3633002.html Free SSL Certificate request
To http://www. Wosign.com/products/free_ssl.htm Request a free SSL certificate.
Download the Www.iamle.com.zip file, unzip the file, find the for nginx.zip extract, get 2 files
1_WWW.IAMLE.COM_BUNDLE.CRT, 2_www.iamle.com.key
Change to a name Www.iamle.com.crt,www.iamle.com.key to the server for backup.
Nginx Configure SSL Certificate deployment HTTPS support
Locate the corresponding server
Increase
Shell
12345678 |
Listen 443 Ssl;ssl On;ssl_certificate/usr/local/nginx/conf/ssl/www.iamle.com.crt;ssl _certificate_key/usr/local/nginx/conf/ssl/www.iamle.com.key;ssl_session_timeout 5m;ssl_protocols TLSv1 TLSv1.1 tlsv1.2;ssl_ciphers all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp;ssl_prefer_server_ciphers on; |
Re-loading Nginx configuration
[Email protected] ssl]#/etc/init.d/nginx Reload
The browser trusted https://www.iamle.com is already available ~
Added conversion of PFX to Nginx required Crt,key
If you already have a certificate with a PFX extension, you need to convert the
Shell
123456789 |
[email protected] ~]# OpenSSL pkcs12-in www.iamle.com.pfx-nocerts-nodes-out www.iamle.com.keyEnter Import Password: Output Enter the certificate password mac verified OK [[email protected] ~]# OpenSSL pkcs12-in www.iamle.com.pfx-clcerts-nokeys-out www.iamle.com.crt Enter Import Password: Enter the certificate password Mac verified OK |
Generate 2 files Www.iamle.com.key, www.iamle.com.pfx Copy to the directory you specified
Reference documents
Http://nginx.org/en/docs/http/configuring_https_servers.html
Installing Nginx under Linux