Installation environment
1. gcc installation
To install nginx, you need to compile the source code downloaded by official website first.
Compilation depends on gcc environment:
yum install gcc-c++
2. pcre pcre-devel installation
Installing pcre-devel is a secondary development library developed with pcre. :
yum install -y pcre pcre-devel
3. zlib installation
Zlib library provides many ways of compression and decompression, and nginx can use zlib to gzip the contents of http packets:
yum install -y zlib zlib-devel
4. openssl installation
A powerful secure socket layer cipher library, with main cryptographic algorithms, common key and certificate encapsulation management functions and ssl protocol. Nginx is required to support https (http over SSL protocol).
yum install -y openssl openssl-devel
Install nginx
Download using wget command
wget -c https://nginx.org/download/nginx-1.9.9.tar.gz
decompression
tar -zxvf nginx-1.9.9.tar.gzcd nginx-1.9.9/
deploy
Common configuration
#./configure
Configure https:
./configure --with-http_ssl_module
fix
makemake install
Find the installation path:
whereis nginx
Start and stop nginx
cd /usr/local/nginx/sbin/./nginx./nginx -s stop./nginx -s quit./nginx -s reload
Notes:
. /nginx -t: check whether the nginx.conf configuration file is correct.
./nginx-quit: The stop step of this method is to stop after the Nginx process finishes processing the task.
. /nginx -s stop: This method is equivalent to finding out the process id of nginx first and then using the kill command to forcibly kill the process.
To configure ssl, please check which server you are using, apply for ssl certificate at the same time when applying for domain name, and then configure it directly in the server load balancing.
Copyright Description:No reproduction without permission。
Knowledge sharing community for developers。
Let more developers benefit from it。
Help developers share knowledge through the Internet。
Follow us