Nginx的安装与配置
一、编译方式安装
** 源码编译方式:**
安装make:yum-y install autoconf automake make
安装g++: yum-y install gcc gcc-c++
一般系统中已经装了了make和g++,无须再装
yum-y install pcre pcre-devel
yum-y install zlib zlib-devel
yum install-y openssl openssl-devel
安装nginx依赖的库
wget
http://nginx.org/download/nginx-1.15.8.tar.gz
tar-zxvf nginx-1.15.8.tar.gz
cd nginx-1.15.8
./configure--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module
配置
--prefix 指定安装目录
--with-http_ssl_module 安装 https 模块
creating objs/Makefile 代表编译成功
make && make install
make 编译
make install 安装
** yum 方式:**
yum install yum-utils
yum-config-manager--add-repo
https://openresty.org/package/centos/openresty.repo
yum install openresty
Nginx 目录结构:
Conf 配置文件
Html
网页文件
Logs
Sbin
日志文件
二进制程序
Nginx 常用命令
启停命令:
./nginx -c nginx.conf 的文件。如果不指定,默认为NGINX_HOME/conf/nginx.conf
./nginx-s stop 停止
./nginx-s quit 退出
./nginx-s reload 重新加载nginx.conf
nginx.conf 配置文件结构
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~