目录
1 安装指南
安装部署 on CENTOS
| 服务器OS : Linux CENTSO 7.9 |
| 待安装的Nginx版本: NGINX 15.12 |
step1 下载安装包
| # cd /usr/local/software/ |
| # wget http://nginx.org/download/nginx-1.15.12.tar.gz |
step2 解压安装包
| # cd /usr/local/software/ |
| # tar -zxvf nginx-1.15.12.tar.gz -C ./ |
step3 安装依赖项
解决异常: ./configure时报的异常:
./configure: error: the HTTP rewrite module requires the PCRE library. ...
参考文献
安装nginx时候提示:./configure: error: the HTTP rewrite module requires the PCRE library. - CSDN
| # yum -y install gcc gcc-c++ automake autoconf libtool make |
| # yum -y install pcre-devel openssl openssl-devel |
step4 配置与安装前检查
| cd /usr/local/software/nginx-1.15.12 |
| |
| ./configure --prefix=/usr/local/nginx \ |
| --conf-path=/usr/local/nginx/conf \ |
| --with-http_stub_status_module \ |
| --with-http_ssl_module |
- ./configure --help
- --prefix=PATH 设置软件安装目录路径
- --with-http_stub_status_module 启用HTTP_Stub_Status模块,状态信息统计模块,用于返回一个Nginx状态信息统计信息页面。管理员访问这个页面可以获取Nginx的请求处理、当前连接、等待连接等统计信息,一般用于监控Nginx的运行状态。默认情况下不构建此模块。
- --conf-path=PATH 设置配置文件安装目录路径
step5 编译
| cd /usr/local/software/nginx-1.15.12 |
| make |
step6 安装
| cd /usr/local/software/nginx-1.15.12 |
| make install |
step7 查验版本
| /usr/local/nginx/sbin/nginx -V |
step8 开启网内外部主机访问端口
防火墙管理,可参见:
| systemctl stop firewalld |
| // service firewalld status |
| // service iptables stop |
| systemctl start firewalld |
| firewall-cmd --permanent --add-port=80/tcp |
| systemctl restart firewalld |
step9 查验运行状态
安装部署 on Windows
step1 下载安装包


step2 解压即安装
| D:\Program\Nginx\nginx-1.27.4 |

step3 CMD命令行启动
-
Win
+ R
键:cmd
-
命令行cmd
: 切换到 nginx目录
| D: |
| cd D:\Program\Nginx\nginx-1.27.4 |
step4 访问
http://127.0.0.1:80
可修改 conf/nginx.conf 的配置,调整端口、静态资源映射等
2 Nginx卸载
卸载 on CENTOS
step1 全局查找Nginx相关文件
step2 删除查找出来的所有Nginx相关文件
| yum remove nginx |
| // 先使用yum清理 |
| |
| sudo rm -rf <fileOrDir> |
| // 最后,依次手动删除查找出来的nginx文件(夹) |
删除之后,便可重新安装nginx了。
X 参考文献