三 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