-
安装依赖包:
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl--devel
-
下载解压nginx
cd /usr/src
wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar -zxvf nginx-1.9.9.tar.gz
-
编译安装
cd nginx-1.9.9
./configure
make prefix=/usr/local/nginx
make prefix=/usr/local/nginx install
echo "export PATH=$PATH:/usr/local/nginx/sbin" >> /etc/bashrc
source /etc/bashrc
-
检查在哪里
whereis nginx
-
启动nginx
nginx
-
测试
wget http://localhost
-
在虚拟机的话要开发防火墙
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙
sudo firewall-cmd --reload
查看防火墙
firewall-cmd --list-all
网友评论