Nginx beginners (a) install and run

(Note: this article is to complete the operation in centOS)

1, the installation package download nginx nginx-1.6.3.tar.gz installation package and copied to / usr / local / software in

2, the installation dependencies, the following command:

-y install gcc-c yum ++ (take a few minutes)
yum install pcre (need to wait a few minutes) 

yum install PCRE-devel (need to wait a few minutes) 

yum install zlib (need to wait a few minutes) 

yum install zlib-devel (take a few minutes)

3, extract the installation package tar -zxvf nginx-1.6.3.tar.gz -C / usr / local /

4, is configured: cd nginx-1.6.3 && ./configure --prefix = / usr / local / nginx

5, run make && make install to compile and install

   Then we saw nginx folder under / usr / local /, after entering look like this (conf is the configuration file directory, html is the root directory (page file), logs is the log file directory, sbin is the main binary program directory)

 

 6, then we start nginx:

/usr/local/nginx/sbin/nginx

7, we run the following command for testing to see whether the start nginx

ps -ef | grep nginx

If that is the chart like this, and that is the successful start

 

 8, then we open the browser to access the address of the virtual machine it will appear the following interface, this nginx installation and startup is complete.

 

 If there is no successful visit (browser going round in circles), run the following command to try

 

firewall-cmd --state see the firewall status (can be saved)

If the result is running, run the following command

firewall-cmd --permanent --zone = public --add-port = 8080 / tcp Adding open port

Then reload

firewall-cmd --reload

Nginx follows other statements

/ usr / local / nginx / sbin / nginx -s stop stop 
/ usr / local / nginx / sbin / nginx -s reload restart

 

Guess you like

Origin www.cnblogs.com/hg1205/p/11756454.html