-
使用yum安装nginx,需要先安装前置环境
$ yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel $ yum update $ wget http://nginx.org/download/nginx-1.17.6.tar.gz
-
解压、编译安装
先解压,进入nginx目录下执行以下命令,$ ./configure #编译 & 安装 $ make && make install
-
基本目录介绍
conf/ 配置相关文件
html/ 存放访问网页
logs/ 日志
sbin/ 启动脚本 -
常用基本命令
在/path/…/sbin/目录下执行:
./nginx 启动./nginx -s stop 关闭
netstat -ano 通过端口找到进程号
kill -9 nginx主进程号 强制停止./nginx -s reload 重启
./nginx -t 不运行,仅测试配置文件
./nginx -v 显示版本
./nginx -V 显示版本,编译器版本及配置参数
./nginx -c </path/to/config> 为nginx指定一个配置文件,代替缺省的
nginx安装与常用命令整理
最新推荐文章于 2022-10-15 17:36:02 发布