随笔分类 - nginx
摘要:Nginx能够有效地缓存指定的静态资源文件,提高网站的响应速度和性能 http { proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=
阅读全文
摘要:openresty 安装依赖 #GCC (gun compiler collection) #gcc-c++ c++ 编译器 yum install gcc gcc-c++ -y # rewrite模块需要 pcre (perl compatible regular expression per 兼
阅读全文
摘要:在Nginx中,可以使用$http_user_agent变量来获取请求的User-Agent头,然后基于这个头的值来决定如何转发请求。 实现方式一: http { map $http_user_agent $backend { default http://backend3; ~*Chrome ht
阅读全文
摘要:mkdir /usr/local/openresty/nginx/conf/ssl cd /usr/local/openresty/nginx/conf/ssl openssl genrsa -out server.key 2048 openssl req -new -key server.key
阅读全文
摘要:location / { # 如果后端服务器返回502 504 执行超时等错误,自动将请求转发到upstream 负载均衡池中另一台服务器。实现故障转移。 proxy_next_upstream http_502 http_504 error timeout invalid_header; prox
阅读全文
摘要:虚拟机 基于ip的多虚拟机 基于端口的多虚拟机 基于域名的多虚拟机 性能 安全 ssl server { listen 80; server_name your_domain_or_IP; # 所有80端口的请求都重定向到443端口 location / { return 301 https://$
阅读全文
摘要:nginx graph LR A[nginx.conf] B[global] C[http] C1[upstream] C2[server] C21[location] C211[if] D[stream] D1[upstream] D2[server] A -.->|worker进程配置| B A
阅读全文
摘要:nginx 反向代理 目录反向代理调度算法七层代理参数解释[7层代理] graph LR A[nginx.conf] B[global] C[http] C1[upstream] C2[server] C21[location] C211[if] D[stream] D1[upstream] D2[
阅读全文
摘要:nginx nginx 进程关系: nginx 由master和worker进程组成,master进程负责管理work进程,worker进程负责处理具体的任务. # 反向代理 目录调度算法四层代理七层代理参数解释[7层代理] graph LR A[nginx.conf] B[global] C[ht
阅读全文
摘要:【目录】 安装依赖 优化内核参数 编译 启动测试 简介 Nginx (engine x http://nginx.org)是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由伊戈尔·赛索耶夫开发的,第一个公开版本0.1.0发布于2004年10月4日其特点
阅读全文