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信息