Home  >  Article  >  Backend Development  >  Install nginx on CenOS Linux

Install nginx on CenOS Linux

WBOY
WBOYOriginal
2016-07-29 08:51:22874browse

1. Install nginx
1. Download a package from the nginx official website. The download address is: http://nginx.org/en/download.html
2. WinSCP (ftp upload tool).exe FTP upload tool uploads to CentOS
3. I first create a directory and put the installation packages to be used together.
#mkdir /home/
#tar zxf nginx-1.4.1.tar.gz
  #cd nginx-1.4.1
  4. Install the pcre development package
  #yum install -y pcre-devel
  5. If the following error appears during installation, it is due to the lack of compilation environment. Install the tools and libraries required to compile the source code
./configure: error: C compiler cc is not found
#yum install gcc gcc-c++ ncurses-devel perl
6. Install cmake from http://www.cmake.org Download the source code and compile and install
​ #yum -y install make gcc gcc-c++ ncurses-devel
​ #yum -y install zlib zlib-devel
​ 7. If you need the ssl function, you need the openssl library
​ #yum -y install openssl openssl--devel
8. Install nginx
#cd nginx-1.4.1
#./configure --prefix=/opt/nginx
#make
9. Start the service
#/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
10. Stop the service
#/opt/nginx/sbin/nginx -s stop
11. Check the port occupancy
#netstat -tunlp
12. If other machines cannot access, solve the problem The method is as follows:
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
Then save:
#/etc/rc.d/init.d/iptables save
Restart the firewall
#/etc/init .d/iptables restart
The above introduces the installation of nginx on CenOS Linux, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn