nginx 使用php-fpm的配置php环境参数

server {
    listen       80;
    server_name  *.shewentm.com;
    server_name  *.filingtm.com;
    server_name  *.shebiaotm.com;

    #charset koi8-r;

  
    #access_log  logs/host.access.log  main;
    #######IP-lian-jie-shu-dong-tai-see######
    location /nginx_status
    {
        stub_status on;
        access_log off;
        add_header Cache-Control no-store;
        allow 192.168.100.0/23;
        allow 192.168.102.0/23;
     allow  172.16.1.0/24;
        deny all;
        #auth_basic              "NginxStatus";
       # auth_basic_user_file    /etc/nginx/default.d/htpasswd;
       # deny all;
    }
    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        root   /var/www/html;
        index  index.html index.htm;
        deny 103.25.21.155;
        deny 117.24.206.123;

    if ($host ~* ^(www|ask|news|m)) {
       proxy_pass http://servers;
    }
    if ($host ~* ^(|www|jm\.filingtm\.com) ) {
           proxy_pass http://filingtm;
    }
    if ($host ~* ^(www\.shewenip\.com) ) {
      proxy_pass http://filingtm;
    }
    
    if ($host ~* ^(|www|news\.shebiaotm\.com) ) {
           proxy_pass http://shebiao;
    }
    if ($host ~* !^((www\.filingtm\.com)|(jm\.filintm\.com))) {
           proxy_pass http://localhost;
    }
    if ($host ~* "^filingtm.com$") {
       rewrite ^(.*) http://www.filingtm.com$1 permanent;
    }
        
    if ($host ~* "^shewenip.com$") {
        rewrite ^(.*) http://www.shewenip.com$1 permanent;
    }
    if ($host ~* "^shebiaotm.com$") {
        rewrite ^(.*) http://www.shebiaotm.com$1 permanent;
    }
    if ($host ~* "^shewentm.com$") {
        rewrite ^(.*) http://www.shewentm.com$1 permanent;
    }

     if ($host ~* !([^w][^w][^w]|[^a][^s][^k]|[^n][^e][^w][^s])) {
#  if ($host ~* !^(www|ask|news)) {
    proxy_pass http://localhost;
    }
    if ($host ~* ^(admin)) {
    proxy_pass http://create;
    }


    proxy_buffer_size 64k;
    proxy_buffers   32 32k;
    proxy_busy_buffers_size 128k;

    proxy_set_header x-real-ip $remote_addr; 
    proxy_cache reverse_cache;
    proxy_cache_valid 200 10m;
    proxy_cache_valid 301 5m;
    proxy_cache_valid 302 5m;
    proxy_cache_valid any 1m;
    proxy_set_header Host $host;
    proxy_redirect off;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout 60;
    proxy_read_timeout 600;
    proxy_send_timeout 600;
    client_max_body_size 10m;
    }
    #location /tdm {
#    rewrite .* http://admin.shewentm.com break;
#}
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    FASTCGI_PASS   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 

server {
  listen 80;
  server_name www.123.com;
  #access_log logs/host.access.log main;
  location / {
  root /var/www/html/chatbk;
  index index.php index.html index.htm;
  try_files $uri $uri /var/www/html/chatbk /index.php?$query_string;
  }
  location ~ \.php$ {
  root /var/www/html/chatbk;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  #fastcgi_param SCRIPT_FILENAME /var/www/html/shebiaotm/WebIM$fastcgi_script_name;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  }
  }

 

  upstream chatbk123 {
  ip_hash;
  server 172.16.1.21:82 fail_timeout=1 max_fails=2;
  }
  server {
  listen 80;
  server_name chatbk.456.com;
  location / {
  proxy_pass http://chatbkshewen;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header REMOTE-HOST $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  client_max_body_size 50m;
  proxy_connect_timeout 30;
  proxy_send_timeout 30;
  proxy_read_timeout 60;
  proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
  }
}

  

posted @ 2018-08-25 14:04  人生信条~~  阅读(686)  评论(0编辑  收藏  举报