当前位置:首页 > nginx > 正文

linux中nginx下载安装(linux 安装nginx 离线安装)

  • nginx
  • 2024-03-18 03:57:35
  • 4936
Linux 中 Nginx 下载和安装
要素:
- 下载 Nginx 源代码:
wget http://nginx.org/download/nginx-latest.tar.gz
- 解压源代码:
tar -zxvf nginx-latest.tar.gz
- 配置编译选项(可省略):
./configure [选项]
常用选项:
- --pre fix=/usr/local/nginx:指定安装目录
- --with-http_ssl_module:编译 SSL 模块
- --with-http_realip_module:编译 Real IP 模块
- 编译安装:
make
make install
- 创建 Nginx 用户和组(可省略):
groupadd nginx
useradd -g nginx nginx
- 配置 Nginx:
编辑配置文件 /usr/local/nginx/conf/nginx.conf,根据需要进行修改。
- 启动 Nginx:
nginx
- 验证安装:
访问 http://localhost 或 http://<服务器 IP> 查看 Nginx 欢迎页面。