nginx指向

upstream pay {
    server 指向ip;
}

#
# The default server
#
server {
    listen       80;
    #listen 443 ssl;

    #ssl_certificate      /etc/nginx/conf.d/020.com.crt;
    #ssl_certificate_key  /etc/nginx/conf.d/020.key;

    server_name  服务器ip 123.com;
    root /var/www/html/fwcs;
    #charset koi8-r;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    if ($args ~ g=Wap&m=Payfree) {
        rewrite  ^  /pay  last;
    }

    location /pay {
        proxy_pass http://pay;
        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 ^~ /wxpay {
        proxy_pass http://pay;
        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 ^~ /tpl/Wap/default/common/CustomerPay {
        proxy_pass http://pay;
    }

    location ^~ /tpl/Wap/default/common/51 {
        proxy_pass http://pay;
    }

    location ^~ /tpl/Wap/default/common/cardpay {
        proxy_pass http://pay;
    }

    location / {
	index index.php index.html index.htm;
 	if (!-e $request_filename) {
        rewrite  ^(.*)$  /index.php/$1  last;
        break; 
        }
    }

   location ~ ^(.*)\/\.svn\/{
      deny all;
   }
   location /unipay {
        proxy_pass http://127.0.0.1:8080/unipay;
    }

   location ~ .+\.php($|/) {
        set $script $uri;
        set $path_info  "/";

        if ($uri ~ "^(.+\.php)(/.+)") {
            set $script     $1;
            set $path_info  $2;
        } 
	try_files $uri =404;
 	fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
	fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_intercept_errors off;
	fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	fastcgi_param PATH_INFO $path_info;
	fastcgi_param SCRIPT_NAME $script;
   	include /etc/nginx/fastcgi_params;
     }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)?$
    {
    expires      4h;
    }

    location ~ .*\.(js|css|log)?$
    {
     expires      -1;
    }
    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
 
  

    #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;
    #}


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



你可能感兴趣的:(PHP)