nginx安装

 
首先把需要的不需要的都装上
1
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre pcre-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

下载安装nginx

1
2
3
4
5
6
7
8
9
10
11
#进入下载目录
/usr/local/src
#下载Nginx源码,目前,最稳定的版本是1.4.1
wget http: //nginx.org/download/nginx-1.4.1.tar.gz
#解压tar包
tar -zxvf nginx-1.4.1.tar.gz
#进入nginx源码目录
cd nginx-1.4.1
./configure --prefix=/usr/local/nginx
make
make install

启动nginx

1
/usr/local/nginx/sbin/nginx

关闭nginx

1
2
ps -ef |grep nginx
kill - 9  [pid]

iptables开启80

1
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

保存iptables设置

1
service iptables save

查看设置

1
service iptables status

如果没成功,可以尝试重启iptables

1
service iptables restart

 

你可能感兴趣的:(nginx)