nginx php 配置

//集群

upstream payOrderServer {

    server 127.0.0.1:7600;

    server 127.0.0.1:7601;

    server 127.0.0.1:7602;

    server 127.0.0.1:7603;

}

//转发强制https

server{

    listen      80;

    server_name  xinpa.lylck.com;

    rewrite ^(.*)$  https://$host$1 permanent;

}

server {

    #listen      80;

    listen      443 ssl;

    #server_name  locahost;

    server_name  xinpa.lylck.com;

    ssl_certificate      conf.d/3132007_xinpa.lylck.com.pem;

    ssl_certificate_key  conf.d/3132007_xinpa.lylck.com.key;

    ssl_session_cache    shared:SSL:1m;

    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;

    ssl_prefer_server_ciphers  on;

    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;

    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 / {

#        #root  /usr/share/nginx/html;

#              root  /data/www/public;

#        index index.php index.html index.htm;

#    }

    location / {

        # First attempt to serve request as file, then

        # as directory, then fall back to displaying a 404.

        root  /data/www/public;

        index index.php index.html index.htm;

        if (!-e $request_filename) {

            rewrite  ^(.*)$  /index.php?s=/$1  last;

            break;

          }

    }

    location /starpay/ {

        proxy_pass https://payOrderServer;

    }

    location /poiusf/ {

      # if (!-e $request_filename){

      #        rewrite /poiusf/(.*)$ /poiusf.php/$1 last;

      #        #rewrite ^(.*)$  /poiusf.php?s=/$1  last;

      #    }

      proxy_pass  http://121.40.169.134/poiusf.php;

    }

    location /usuetr/ {

      # if (!-e $request_filename){

      #        rewrite /poiusf/(.*)$ /poiusf.php/$1 last;

      #        #rewrite ^(.*)$  /poiusf.php?s=/$1  last;

}

server{

    listen      80;

    server_name  xinpa.lylck.com;

    rewrite ^(.*)$  https://$host$1 permanent;

}

server {

    #listen      80;

    listen      443 ssl;

    #server_name  locahost;

    server_name  xinpa.lylck.com;

    ssl_certificate      conf.d/3132007_xinpa.lylck.com.pem;

    ssl_certificate_key  conf.d/3132007_xinpa.lylck.com.key;

    ssl_session_cache    shared:SSL:1m;

    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;

    ssl_prefer_server_ciphers  on;

    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;

    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 / {

#        #root  /usr/share/nginx/html;

#              root  /data/www/public;

#        index index.php index.html index.htm;

#    }

    location / {

        # First attempt to serve request as file, then

        # as directory, then fall back to displaying a 404.

        root  /data/www/public;

        index index.php index.html index.htm;

        if (!-e $request_filename) {

            rewrite  ^(.*)$  /index.php?s=/$1  last;

            break;

          }

    }

    location /starpay/ {

        proxy_pass https://payOrderServer;

    }

    location /poiusf/ {

      # if (!-e $request_filename){

      #        rewrite /poiusf/(.*)$ /poiusf.php/$1 last;

      #        #rewrite ^(.*)$  /poiusf.php?s=/$1  last;

      #    }

      proxy_pass  http://121.40.169.134/poiusf.php;

    }

    location /usuetr/ {

      # if (!-e $request_filename){

      #        rewrite /poiusf/(.*)$ /poiusf.php/$1 last;

      #        #rewrite ^(.*)$  /poiusf.php?s=/$1  last;

      #    }

      proxy_pass  http://121.40.169.134/usuetr.php;

    }

    #error_page  404              /404.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          /data/www/public;

        fastcgi_pass  127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        fastcgi_param  PATH_INFO  $fastcgi_path_info;

        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;

        include        fastcgi_params;

  }

    # deny access to .htaccess files, if Apache's document root

    # concurs with nginx's one

    #

    #location ~ /\.ht {

    #    deny  all;

    #}

}

你可能感兴趣的:(nginx php 配置)