CENTOS compile and install Nginx
1. Download a package from nginx official website, the download address is:http://nginx.org/en/download. html 2. WinSCP (ftp upload tool).exe FTP upload tool is uploaded to CentOS 3. I first create a directory and put together the installation packages to be used. #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 installation error appears below is the lack of a 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 #yum -y install make gcc gcc-c++ ncurses-devel #yum -y install zlib zlib-devel 7. If you need ssl function, you need openssl library #yum -y install openssl openssl –devel 8. Install nginx #cd nginx-1.4.1 #./configure –prefix=/opt/nginx #make #make install 9. Start the service #/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf 10. Stop service #/opt/nginx/sbin/nginx -s stop 11. Check port occupancy #netstat -tunlp 12. If other machines cannot be accessed, the solution 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