博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx 配置实例(ssl、proxy、cache、gzip、upstream等优化)
阅读量:4837 次
发布时间:2019-06-11

本文共 2628 字,大约阅读时间需要 8 分钟。

[root@xxxxxxxxxxxxxx ~]# cat /usr/local/nginx/conf/nginx.confuser  nobody;worker_processes  4;worker_cpu_affinity 0001 0010 0100 1000;error_log  logs/error.log;pid        logs/nginx.pid;events {    worker_connections  10240;    accept_mutex on;    multi_accept on;    use epoll;}http {    include       mime.types;    default_type  application/octet-stream;    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                      '$status $body_bytes_sent "$http_referer" '                      '"$http_user_agent" "$http_x_forwarded_for"';    access_log  logs/access.log  main;    sendfile        on;    tcp_nopush     on;    keepalive_timeout  30;    keepalive_requests 50000;    send_timeout 15;    gzip  on;    gzip_min_length 1024;    gzip_buffers 16 8k;    gzip_types text/plain application/x-javascript application/javascript application/json text/css application/xml image/jpeg image/gif image/png;    gzip_comp_level 6;    gzip_disable "MSIE 6\.";    proxy_cache_path /usr/local/nginx/nginx_cache/ levels=1:2 keys_zone=my_zone:10m inactive=300s max_size=5g;    include vhost/*.conf;}
upstream  yyyyyyy.com {   server 127.0.0.1:8081  weight=1;   server 127.0.0.1:8082  weight=1;  }server{    listen 443 ssl;    server_name www.yyyyyyy.com yyyyyyy.com;    ssl_certificate /usr/local/nginx/cert/yyyyyyy.com/2286250_yyyyyyy.com.pem;    ssl_certificate_key /usr/local/nginx/cert/yyyyyyy.com/2286250_yyyyyyy.com.key;    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!eNULL;    ssl_prefer_server_ciphers on;    proxy_buffering on;    proxy_buffer_size 4k;    proxy_buffers 8 4k;    proxy_busy_buffers_size 16k;    proxy_temp_path /usr/local/nginx/proxy_temp 1 2;    proxy_max_temp_file_size 100M;    proxy_temp_file_write_size 16k;        location /{        root   /usr/local/android/marketone;        index  index.html index.htm;        error_page   500 502 503 504  /50x.html;        proxy_cache my_zone;        location = /50x.html {            root   html;        }    }        location /api/upload/ {        proxy_pass http://127.0.0.1:8081/estrendMarket/upload/;        proxy_set_header Host   $host;        proxy_set_header X-Real-IP      $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }    location /api/ {        proxy_pass http://xxxxxx.com/estrendMarket/;        index  index.html index.htm;        proxy_set_header Host   $host;        proxy_set_header X-Real-IP      $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }}

 

转载于:https://www.cnblogs.com/yyxianren/p/11320422.html

你可能感兴趣的文章
solr集群SolrCloud(solr+zookeeper)windows搭建
查看>>
LightOJ 1370 Bi-shoe and Phi-shoe(欧拉函数)
查看>>
51nod 1351 吃点心(贪心)
查看>>
Vim配置(python版)
查看>>
Sublime Text2编辑器
查看>>
atan2 pow
查看>>
Java 类的继承
查看>>
没有美工一样可以获取设计各种各样的UI图
查看>>
[转载学习]博弈类题目小结
查看>>
百度面试题
查看>>
内核开发基础3——Linux内核配置与编译
查看>>
计算机组成原理复习
查看>>
BUPT复试专题—中序遍历序列(2013)
查看>>
【常见Web应用安全问题】---7、CRLF injection
查看>>
php7.2.1 安装
查看>>
用winrar解压时提示无法设置安全数据 拒绝访问的解决方法
查看>>
诡异的数学,数字问题 - leetcode
查看>>
交换输出
查看>>
设计模式-策略模式&状态模式&访问者模式
查看>>
python学习第三十三节(IO模型)
查看>>