02_ nginx 安装

2.1 进入 nginx 官网,下载

http://nginx.org/

nginx-1.19.1.tar.gz

2.2 安装 nginx

1)、使用 wget 安装 pcre
https://ftp.pcre.org/pub/pcre/pcre2-10.35.tar.gz
https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz

pcre2-10.35.tar.gz 或 pcre-8.44.tar.gz

2)、解压文件
./configure 完成后,回到 pcre 目录下执行 make, 
3)、再执行 make && make install
make && make install PREFIX=/usr/local/nginx
4)、安装 openssl zlib
yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel 
可选
# 一键安装上面四个依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
5)、安装 nginx
1、 解压缩 nginx-xx.tar.gz 包。 
2、 进入解压缩目录,执行./configure。  
3make && make install PREFIX=/usr/local/nginx

6)、查看开放的端口号
firewall-cmd --list-all
7)、设置开放的端口号
firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-port=80/tcp --permanent
8)、重启防火墙
firewall-cmd --reload

3、测试

1、cd /usr/local/nginx/sbin
# 启动 nginx
2、./nginx 
3、curl localhost:80/ 或 https://ip:80/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
posted @   hellozwx  阅读(105)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
历史上的今天:
2019-07-30 win10下ideaIU-2019.2.exe的安装与激活
点击右上角即可分享
微信分享提示