下载
官网 download: nginx: download
这里选择 1.24.0 版本
上传到服务器
解压到指定目录
tar -zxvf nginx-1.24.0.tar.gz
配置
./configure --prefix=/home/nginx \
--sbin-path=/home/nginx \
--conf-path=/home/nginx/conf/nginx.conf \
--pid-path=/home/nginx/logs/nginx.pid \
--with-http_stub_status_module \
--with-http_ssl_module
参数说明
参数 | 说明 |
---|---|
–prefix=/home/nginx | 配置安装目录为 /home/nginx |
–sbin-path=/home/nginx | 配置执行文件安装目录 /home/nginx (默认名称: nginx) |
–conf-path=/home/nginx/nginx.conf | 配置配置文件目录 |
–pid-path=/home/nginx/nginx.pid | 配置 pid 文件目录 |
–with-http_stub_status_module | 添加性能统计模块 |
–with-http_ssl_module | 添加 ssl 模块 |
其他路径参数参考: Nginx 安装相关参数
安装
1. 执行 make
2. 执行 make install
启动, 关闭 …
./nginx -c confPath # 启动nginx , 并指定配置文件
./nginx -s reload # 重新加载 nginx , 可使修改后的配置文件生效
./nginx -s quit # 关闭 nginx
常用命令参考: Nginx 常用命令
下载地址
为了方便安装, 已经配置了自动安装脚本, 下载地址: 阿里云盘-nginx