CentOS安装成功nginx配置

输入命令: 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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值