CentOS7.6安装Nginx

下载nginx

1
2
# 如果下载不了可以去官网下载 http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.24.0.tar.gz

安装依赖

1
2
# gcc编译器 zlib压缩库 pcre正则表达式库 openssl安全套接字库 make编译工具 
yum -y install gcc zlib zlib-devel pcre pcre-devel openssl openssl-devel make

解压nginx

1
tar -zxvf nginx-1.24.0.tar.gz

编译安装

1
2
3
4
5
cd nginx-1.24.0 # 进入解压后的目录
# --prefix指定安装目录 --with-http_stub_status_module启用状态模块 --with-http_ssl_module启用ssl模块
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make # 编译
make install # 安装

启动nginx

1
/usr/local/nginx/sbin/nginx 

查看nginx进程

1
ps -ef | grep nginx

浏览器访问

1
http://ip:80

CentOS7.6安装Nginx
https://987654321.org/posts/centos_install_nginx/
作者
longchunxin
发布于
2025年2月15日
许可协议