Nginx installation in lnmp environment and nginx in lnmp Environment
1. What is nginx?
1) Nginx is a lightweight Web server/reverse proxy server and email proxy server, which is released under a BSD-like protocol.
2) features: it has a small amount of memory and is capable of concurrent sending. In fact, nginx's concurrency is indeed good in the same type of Web server.
1. Preparations before installation:
# First, check whether the compilation package and some dependent packages are installed.
# Yum install gcc-c ++ openssl-devel zib
2. Install pcre
# Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
# Tar zxvf pcre-8.39.tar.gz
Compile and install
# Cd pcre-8.39
#./Configure -- prefix =/usr/local/pcre
# Make & make install
3. Install nginx
# Wget http://nginx.org/download/nginx-1.6.2.tar.gz
# Tar-zxvf nginx-1.6.2.tar.gz
# Cd nginx-1.6.2
#./Configure -- prefix =/usr/local/nginx -- with-pcre = usr/local/pcre -- with-http_stub_status_module
# Make & make install
5. Start nginx
Check the nginx Configuration File Syntax.
#/Usr/local/nginx/sbin/nginx-t
If not, the following message is displayed:
Nginx: the configuration file/usr/local/nginx-1.4.6/conf/nginx. conf syntax is OK
Nginx: configuration file/usr/local/nginx-1.4.6/conf/nginx. conf test is successful
Start nginx
#/Usr/local/nginx/sbin/nginx
Reload nginx
#/Usr/local/nginx/sbin/nginx-s reload
There is no error in this step, so you can access the ip address.
Ii. troubleshooting during installation:
1. Solve nginx: [error] open () "/usr/local/nginx/logs/nginx. pid" failed error
Solution:
[Root @ localhost nginx] #/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx. conf
2. solution./configure: error: the HTTP rewrite module requires the PCRE library.
# Yum-y install pcre-devel
The above is for personal installation and is for reference only!