Nginx学习笔记-Centos 7 安装Nginx

前置条件#

安装GCC#

yum install -y gcc-c++

安装pcre#

yum install -y pcre pcre-devel

安装zlib#

yum install -y zlib zlib-devel

安装openssh#

yum install -y openssl openssl-devel

安装Nginx#

下载Nginx#

官网:https://nginx.org/en/download.html

curl -o /usr/local/src/Nginx/nginx-1.23.4.tar.gz https://nginx.org/download/nginx-1.23.4.tar.gz

解压&编译安装#

# 进入目录
cd /usr/local/src/Nginx/nginx-1.23.4
# 编译
./configure --prefix=/usr/local
# 安装
make & make install

常用命令#

# 查看帮助信息
nginx -h
# 查看nginx版本
nginx -v
# 启动nginx
nginx -c filename(配置文件名称及路径)
# 停止nginx
nginx -s quit(平滑停止) / nginx -s stop(立即停止)
# 重载nginx配置文件
nginx -s reload
# 检查配置文件是否正确
nginx -t -c filename(配置文件名称及路径)

Nginx安装其他模块#

ngx_http_stub_status_module为例,在编译时需要加上该模块,https://nginx.org/en/docs/http/ngx_http_stub_status_module.html

# 进入目录
cd /usr/local/src/Nginx/nginx-1.23.4
# 编译
./configure --prefix=/usr/local --with-http_stub_status_module
# 安装
make & make install

作者:jruing

出处:https://www.cnblogs.com/jruing/p/17391716.html

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   Jruing  阅读(80)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
历史上的今天:
2021-05-11 Leetcode <58. 最后一个单词的长度>
more_horiz
keyboard_arrow_up dark_mode palette
选择主题
menu
点击右上角即可分享
微信分享提示