企业高性能web服务器

三 Nginx 核心配置详解

编译安装 Nginx

[root@Nginx nginx-1.24.0]# ./configure  --prefix=/usr/local/nginx \
--user=nginx \                              #指定nginx运行用户
--group=nginx \                             #指定nginx运行组                   
--with-http_ssl_module \                    #支持https://
--with-http_v2_module \                     #支持http版本2
--with-http_realip_module \                 #支持ip透传
--with-http_stub_status_module \            #支持状态页面 
--with-http_gzip_static_module \            #支持压缩
--with-pcre \                               #支持正则
--with-stream \                             #支持tcp反向代理
--with-stream_ssl_module \                  #支持tcp的ssl加密
make && make install

把nginx软件的执行命令路径添加到环境变量中

启动nginx

查看效果

Nginx 启动文件

平滑升级

把之前的旧版的nginx命令备份并且把新版本的nginx命令复制过去

再启动发现80端口正在被使用

使用 kill -USR2 24809 #nginx worker id 清除旧进程

回收旧版本

版本检测

回滚

Nginx 核心配置详解

3.4 核心配置示例

3.4.1 新建一个 PC web 站点

配置文件

测试

3.4.2 root 与 alias

root

测试

alias

测试

3.4.4 Nginx 账户认证功能

测试

3.4.5 自定义错误页面

3.4.6 自定义错误日志

3.4.7 检测文件是否存在

测试

3.4.8 长连接配置

测试

3.4.9 作为下载服务器配置

四 Nginx 高级配置

4.1 Nginx 状态页

4.2 Nginx 压缩功能

五Nginx Rewrite 相关功能

5.3.1 实现盗链

5.3.2 实现防盗链

六 Nginx 反向代理功能

nginx的反向代理及动静分离实现

nginx反向代理的缓存功能

http 反向代理负载均衡

实现 FastCGI

php源码编译

[root@nginx php-8.3.9]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd

[root@nginx php-8.3.9]# make && make install

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值