输入命令: whereis nginx
nginx:[root@hadoop1 /]# whereis nginx
nginx: /usr/local/nginx
如果没有查到,没有安装
wget http://nginx.org/download/nginx-1.1.10.tar.gz
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure
make
make install
常见错误
make: *** No rule to make target 'build', needed by 'default'. Stop.
解决:
yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel
make[1]: *** [objs/Makefile:424: objs/src/core/ngx_murmurhash.o] Error 1
1. 首先利用配置文件启动nginx。
命令: nginx -c /usr/local/nginx/conf/nginx.conf
注意:/usr/local/nginx/conf/nginx.conf 是安装目录,不是存放"安装包"的位置
重启服务: service nginx restart
2. 快速停止或关闭Nginx:nginx -s stop
3. 正常停止或关闭Nginx:nginx -s quit
4. 配置文件修改重装载命令:nginx -s reload
1 nginx.conf
注意:nginx 安装好后80 端口号访问不
2 80 端口号访问不
1.)打开iptables的配置文件:vi /etc/sysconfig/iptables
按esc 然后 :wq 保存退出
2).然后停止并重新启动:
service iptables stop
service iptables start
验证一下是否规则都已经生效:iptables -L
起动 nginx
nginx -c /usr/local/nginx/conf/nginx.conf
注意:/usr/local/nginx/conf/nginx.conf 是安装目录,不是存放安装包的位置
安装Nginx
通过yum search nginx看看是否已经添加源成功。如果成功则执行下列命令安装Nginx。
sudo yum install -y nginx
3、启动Nginx并设置开机自动运行
sudo systemctl start nginx.service
sudo systemctl enable nginx.service