1024programmer Nginx CENTOS compile and install Nginx

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

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/centos-compile-and-install-nginx/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索