官网
选择Stable版本下载即可
安装方式
源码安装
- 下载Nginx(其他下载方式亦可):wget https://nginx.org/download/nginx-1.20.1.tar.gz
- 解压: tar -xf nginx-1.20.1.tar.gz
- 进入源码目录:cd nginx-1.20.1
- 查看编译配置 : ./configure --help
- 安装依赖库: yum install pcre pcre-devel openssl openssl-devel -y
- ./configure --with-http_ssl_module --with-http_v2_module --with-stream
- 编译并安装: sudo make -j && make install
- 加入环境变量: vi /etc/profile
- 加入环境变量: 添加: export PATH=$PATH:/usr/local/nginx/sbin
- 使生效 source /etc/profile
- 加入system系统管理(顶格写): vi /usr/lib/systemd/system/nginx.service
- 写入以下内容:
[Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop [Install] WantedBy=multi-user.target
- 重载system服务: systemctl daemon-reload
- 启动: systemctl start nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下