nginx
安装 Nginx 服务
CentOS
首先:
yum install epel-release
yum install nginx
Debian/Ubuntu
dnf install nginx
Fedora
apt install nginx
查看 Nginx 版本
查看版本
nginx -v
详细的使用:
nginx -V
检查Nginx配置语法正确
nginx -t
也可以查看安装目录
启动 Nginx 服务
#systemd
systemctl start nginx
或
#sysvinit
service nginx start
端口开启
如果服务器开启了防火墙,打开 80(HTTP)和 443(HTTPS)端口
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
开机自启动
systemctl enable nginx
or
service nginx enable
重启 Nginx 服务
systemctl restart nginx
or
service nginx restart
查看 Nginx 服务状态
systemctl status nginx
or
service nginx status
重载 Nginx 服务吗,配置文件更新,重置载入
systemctl reload nginx
or
service nginx reload
停止 Nginx 服务
systemctl stop nginx
or
service nginx stop
查看进程,使用lsof命令 ,也查到80端口进程是否有进程在运行。
lsof -i:80
查看软件安装路径
whereis nginx
查询运行文件所在路径
which nginx