lomg 发表于 2018-11-8 11:36:25

[Nginx] – 配置优化 – NGINX.CONF [三]

硬盘:  # df -h

  Filesystem                        >  /dev/mapper/vg_ghzz-lv_root         50G   19G   28G41% /
  tmpfs                              3.9G   03.9G   0% /dev/shm
  /dev/sda1                        485M   39M421M   9% /boot
  /dev/mapper/vg_ghzz-lv_home      435G   94G320G23% /home
  内存
  # free -m
  total       used       free   shared    buffers   cached
  Mem:          7872       7645      226          0      272       2895
  -/+ buffers/cache:       4477       3395
  Swap:         8015       1475       6540
  # uname -r
  2.6.18-308.el5
  提示:这是线上的一台nginx 反向代理服务器
  userroot;
  worker_processes4;
  error_loglogs/error.log;
  error_loglogs/error.lognotice;
  error_loglogs/error.loginfo;
  events {
  worker_connections15535;
  }
  http {
  include       mime.types;
  default_typeapplication/octet-stream;
  log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
  '$status $body_bytes_sent "$http_referer" '
  '"$http_user_agent" "$http_x_forwarded_for"';
  access_loglogs/access.logmain;
  sendfile      on;
  tcp_nopush   on;
  keepalive_timeout65;
  client_max_body_size 300m;
  gzip on;
  gzip_buffers   4 16k;
  gzip_http_version 1.1;
  gzip_comp_level 9;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
  proxy_connect_timeout    3;
  proxy_read_timeout       60;
  proxy_send_timeout       60;
  #proxy_buffer_size      12800k;
  #proxy_buffers            4 16400k;
  #proxy_busy_buffers_size 12800k;
  #proxy_temp_file_write_size 12800k;
  #gzipon;
  large_client_header_buffers 4 512k;
  client_header_buffer_size 512k;
  proxy_temp_path/data/nginx/temp;
  proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
  fastcgi_intercept_errors on;
  upstream yx.qiuyt.com{
  serverqiuyt.com:8280;
  ip_hash;
  }
  upstream upnew.qiuyt.com{
  serverqiuyt.com:80;
  ip_hash;
  }
  upstream up.qiuyt.com{
  serverqiuyt.com:8081;
  ip_hash;
  }
  upstream ask.qiuyt.com{
  server qiuyt.com:80;
  ip_hash;
  }
  upstream bxg.tbh.qiuyt.com{
  server 127.0.0.1:8205;
  ip_hash;
  }
  upstream league{
  server127.0.0.1:8080;
  ip_hash;
  }
  server {
  listen       80;
  server_namewww.qiuyt.com;
  access_loglogs/www.access.logmain;
  location / {
  root   html;
  indexindex.html index.htm;
  proxy_pass            http://www.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  }
  server {
  listen 80;
  server_name ask.qiuyt.com;
  access_loglogs/ask.access.log main;
  location / {
  proxy_pass            http://ask.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  error_page500 502 503 504 /50x.html;
  location = /50x.html {
  root html;
  }
  }
  server {
  listen 80;
  server_name bxg.tbh.qiuyt.com;
  access_log logs/tbh.access.log main;
  location / {
  proxy_pass          http://bxg.tbh.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  error_page500 502 503 504 /50x.html;
  location = /50x.html {
  root html;
  }
  }
  server {
  listen       80;
  server_namest.qiuyt.com;
  access_loglogs/st.access.logmain;
  location / {
  root   html;
  indexindex.html index.htm;
  proxy_pass            http://league;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  #error_page404            /404.html;
  # redirect server error pages to the static page /50x.html
  #
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  }
  server {
  listen       80;
  server_nameyx.qiuyt.com;
  access_loglogs/yx.access.logmain;
  location / {
  root   html;
  indexindex.html index.htm;
  proxy_pass            http://yx.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  #error_page404            /404.html;
  # redirect server error pages to the static page /50x.html
  #
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  }
  server {
  listen       80;
  server_nameup.qiuyt.com;
  access_loglogs/up.access.logmain;
  location ^~ /study/ {
  root   html;
  indexindex.html index.htm;
  proxy_pass            http://up.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  location / {
  root   html;
  indexindex.html index.htm;
  proxy_pass            http://upnew.qiuyt.com;
  proxy_set_header      X-Real-IP $remote_addr;
  proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header      Host $http_host;
  }
  #error_page404            /404.html;
  # redirect server error pages to the static page /50x.html
  #
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  }
  server {
  listen       80;
  server_name club.qiuyt.com;
  root   /data/webapps/club;
  location / {
  indexindex.html index.htm;
  }
  }
  server {
  listen       80;
  server_name book.qiuyt.com;
  root   /data/webapps/book;
  location / {
  indexindex.html index.htm;
  }
  }
  server {
  listen       80;
  server_name dvd.qiuyt.com;
  root   /data/webapps/dvd;
  location / {
  indexindex.html index.htm;
  }
  }
  server {
  listen       80;
  server_name openclass.qiuyt.com;
  root   /data/webapps/openclass;
  location / {
  indexindex.html index.htm;
  }
  }
  server {
  listen       80;
  server_name resource.qiuyt.com;
  root   /data/webapps/resource;
  location / {
  indexindex.html index.htm;
  }
  }
  }

页: [1]
查看完整版本: [Nginx] – 配置优化 – NGINX.CONF [三]