Install Nginx 1.12.2 in CentOS 6.4
1. Install GCC
To install nginx, you must first compile the source code downloaded from the official website. The compilation depends on the gcc environment. If there is no gcc environment, you must install
Yum install gcc-c ++
2. Install PCRE-devel
PCRE (Perl Compatible Regular Expressions) is a Perl library, including a perl-Compatible Regular Expression Library. The http module of nginx uses pcre to parse regular expressions. Therefore, you need to install the pcre Library on linux. pcre-devel is a secondary development library developed using pcre. Nginx also needs this library.
Yum install-y pcre-devel
3. Install zlib
The zlib library provides many compression and decompression methods. nginx uses zlib to perform gzip on the http package content. Therefore, you need to install the zlib library on CentOS.
Yum install-y zlib-devel
4. Install OpenSSL
OpenSSL is a powerful secure socket-layer cryptographic library that includes major cryptographic algorithms, common keys, certificate encapsulation management functions, and SSL protocols, and provides a wide range of applications for testing or other purposes.
Nginx not only supports the http protocol, but also supports https (that is, transmitting http over the ssl protocol). Therefore, you need to install the OpenSSL library in Centos.
Yum install-y openssl-devel
5. Download Nginx
Next, download the latest stable version of Nginx from the official Nginx website. Currently, it is 1.12.2. Download it, upload it to any directory through ftp, and decompress it.
Tar-zxvf nginx-1.12.2.tar.gz
Cd nginx-1.12.2
6. Configure and install
./Configure
Make & make install
7. view the Nginx installation directory
Whereis nginx
8. Start and Stop Nginx
./Nginx-s quit: The stop process is to stop the nginx process after processing the task.
./Nginx-s stop: This method is equivalent to first identifying the nginx process id and then using the kill command to forcibly kill the process.
# Cd/usr/local/nginx/sbin/
./Nginx
./Nginx-s stop
./Nginx-s quit
./Nginx-s reload
9. View Nginx Processes
# Ps aux | grep nginx
Configure HTTPS for Nginx
# HTTPS server
#
Server {
Listen 443 ssl;
Server_name www. zj ***. com zj ***. com;
Ssl_certificate/usr/local/nginx/sslkey/zj ***. com_bundle.crt;
Ssl_certificate_key/usr/local/nginx/sslkey/zj ***. com. key;
Ssl_session_cache shared: SSL: 1 m;
Ssl_session_timeout 5 m;
Ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
Ssl_ciphers ECDH: AESGCM: HIGH :! RC4 :! DH :! MD5 :! ANULL :! ENULL;
Ssl_prefer_server_ciphers on;
Location /{
Root html;
Index index.html index.htm;
If ($ http_user_agent ~ * "Java | python | perl | ruby | curl | bash | echo | uname | base64 | decode | md5sum | select | concat | httprequest | nmap | scan "){
Return 403;
}
# Proxy_pass http: // localhost: 8080;
Proxy_pass http://mydomain.com;
Proxy_buffer_size 128 k;
Proxy_buffers 32 128 k;
Proxy_busy_buffers_size 128 k;
Proxy_temp_file_write_size 64 m;
}
}
You may also like the following Nginx articles. For more information, see:
Installation configuration https://www.bkjia.com/Linux/2017-04/142986.htm of Nginx server in CentOS 7
Install Nginx server on CentOS for virtual host and Domain Name Redirection https://www.bkjia.com/Linux/2017-04/142642.htm
CentOS 6.8 install LNMP environment (Linux + Nginx + MySQL + PHP) https://www.bkjia.com/Linux/2017-04/142880.htm
Install the PHP environment in Linux and configure Nginx to support php-fpm module https://www.bkjia.com/Linux/2017-05/144333.htm
SSL authentication and htpasswd authentication https://www.bkjia.com/Linux/2017-04/142478.htm for Nginx services
Enable encrypted secure Nginx Web Server https://www.bkjia.com/Linux/2017-07/145522.htm on Ubuntu 16.04
Installation and configuration of Nginx in Linux and detailed description of parameters https://www.bkjia.com/Linux/2017-05/143853.htm
Nginx log filtering using ngx_log_if does not record specific log https://www.bkjia.com/Linux/2014-07/104686.htm
CentOS 7.2 Nginx + PHP + MySQL + Memcache Cache Server Installation configuration https://www.bkjia.com/Linux/2017-03/142168.htm
CentOS 7.2 install Nginx 1.13.6 https://www.bkjia.com/Linux/2018-02/150752.htm
CentOS6.9 compile and install the Nginx1.4.7 https://www.bkjia.com/Linux/2017-06/144473.htm
Nginx details: click here
Nginx: click here
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151202.htm