一、安装nginx依赖lib库:
1、yum install gcc-c++ -y
2、yum install pcre pcre-devel -y
3、yum install zlib zlib-devel -y
4、yum install openssl openssl-devel -y
二、安装nginx
1、切换到目录 /usr/local: cd /usr/local
2、下载nginx: wget http://nginx.org/download/ngnix-1.9.8.tar.gz
3、解压 nginx 包: tar -zxvf ngnix-1.9.8.tar.gz
4、切换到解压目录: cd ngnix-1.9.8
5、使用--prefix来指定nginx的安装目录,make, make install安装
1) ./configure
2) make
3) make install
6、安装完成后,即可查看nginx的相关文件: whereis nginx
7、启动nginx : /usr/local/nginx/sbin/nginx
8、查看启动状况: ps -aux | grep nginx
9、添加http,这样局域网内的电脑才可以访问:
1) firewall-cmd --permanent --add-rich-rule=‘rule family=ipv4 service name=http source address=172.16.1.0/24 accept‘
2) firewall-cmd --reload
PS: 文章来自 http://www.centoscn.com/image-text/install/2014/0812/3480.html