Home >Backend Development >PHP Tutorial >Linux--install nginx
1. Install nginx
1. Download a package from the nginx official website, the download address is: http://nginx.org/en/download.html
2. Upload to the CentOS server via ftp
3. First create a directory and put together the installation packages you want to use
#mkdir /data/kkweb
#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 occurs during installation, it is due to a 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, Download the source code from http://www.cmake.org and compile and install it
#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=/data/kkweb/nginx
#make
#make install
9. Start the service
#/data/kkweb/nginx/sbin/nginx
10. Stop the service
12. If Other machines cannot be accessed. The solution is as follows:
Check whether port 80 is open, if not
#vi /etc/sysconfig/iptables Add: -A INPUT -m tcp -p tcp --dport 80 -j ACCEPT
#service iptables start
Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces Linux-installing nginx, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.