nginx-1.12.0 installed

1. Configure-related environment:

yum install -y gcc glibc gcc-c++ zlib pcre-devel openssl-devel

rewrite module requires pcre library
ssl feature requires openssl library
gzip module requires zlib library

2. Create a user nginx

useradd -s /sbin/nologin -M www

-M do not create home directories

3. Enter the user-level source directory and download the source nginx

www.nginx.org


cd /usr/local/src
wget http://nginx.org/download/nginx-1.12.0.tar.gz

4. Package and extract the source into the directory nginx,

nginx-tar xzvf 1.12.0.tar.gz 
cd nginx-1.12.0 /

5. Execute ./configure script checks the environment, generate installation rules file makefile

./configure --prefix=/usr/local/nginx-1.12.0 --user=www --group=www  --with-http_ssl_module --with-http_stub_status_module

--with-http_stub_status_module status module for monitoring nginx

6. compile and install according to the makefile

make && make install

7. Create a soft link

ln -s /usr/local/nginx-1.12.0/ /usr/local/nginx

8. Check whether the port is occupied 80

netstat -ntlp

9. edit the configuration file /usr/local/nginx/conf/nginx.conf

vim /usr/local/nginx/conf/nginx.conf

location is used to match the uniform resource identifier (URI)

10. The test configuration file

/usr/local/nginx/sbin/nginx -t

11. Start nginx

/usr/local/nginx/sbin/nginx

/usr/local/nginx/sbin/nginx -s reload 重启nginx

Guess you like

Origin www.cnblogs.com/Peter2014/p/11640744.html