centos安装nginx

centos8:
一、安装
yum install nginx
二、配置文件
/etc/nginx/nginx.conf
三、启动停止
systemctl start nginx
nginx

service nginx start
systemctl stop nginx
nginx -S stop

service nginx stop
重装加载配置: nginx -s reload
平滑重启命令: kill -HUP nginx进程号
四、使用
man nginx
info nginx

Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /etc/nginx/)
  -c filename   : set configuration file (default: /etc/nginx/nginx.conf)
  -g directives : set global directives out of configuration file

nginx -s reopen
nginx -s start
nginx -s stop
五、启动后无法访问
对应网站IP能ping通,ssh能访问,但是网页访问超时,telnet网站端口的时候提示no route to host。
是防火墙的原因,Centos7中默认将原来的防火墙iptables升级为了firewalld。
centos8里面关闭防火墙:
systemctl stop firewalld.service
systemctl disable firewalld.service


centos6.10:
一、安装
无法直接通过yum install安装,通过rpm包或者源码安装。
依赖:
yum install gcc-c++  
yum -y install pcre*  
yum -y install openssl*

官方rpm包安装:
http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.8.1-1.el6.ngx.x86_64.rpm

源码安装会复杂些,如果需要网络上搜索一下。
源码包:http://nginx.org/download

更新:发现腾讯云centos6.9可以通过yum install安装,为什么我的6.10不能安装?
二、配置文件
/etc/nginx/nginx.conf
三、启动
/etc/init.d/nginx start
service nginx start
四、使用
没有man/info信息

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值