NGINX.conf配置文件支持pathinfo

NGINX.conf配置文件支持pathinfo

#  power by www.php.cn
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  4096;
}


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  0;
    keepalive_timeout  65;
    #tcp_nodelay on;
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 128k;
  fastcgi_buffers 4 128k;
  fastcgi_busy_buffers_size 256k;
  fastcgi_temp_file_write_size 256k;

  #gzip  on;
  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 32k;
  gzip_http_version 1.1;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
  gzip_disable "MSIE [1-6].";

  server_names_hash_bucket_size 128;
  client_max_body_size     100m; 
  client_header_buffer_size 256k;
  large_client_header_buffers 4 256k;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        root    "D:/phpstudy/PHPTutorial/WWW";
        location / {
            index  index.html index.htm index.php l.php;
           autoindex  off;
        }

        #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   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(.*)$  {
            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;
        #}
    }
    
############################
    #以下是移民虚拟主机配置
    server {
        listen       80;
        server_name  hzym.com;
        root    "D:\phpstudy\PHPTutorial\WWW\www.welltrend.com.cn\www";
        
          location / { 
          index  index.php index.html index.htm;
       if (!-e $request_filename) {
       rewrite  ^(.*)$  /index.php?s=$1  last;
       break;
        }
     }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       
        location ~ \.php(.*)$  {
            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;
            include        fastcgi.conf;
        }
    }
    server {
        listen       80;
        server_name  m.hzym.com;
        root    "D:\phpstudy\PHPTutorial\WWW\www.welltrend.com.cn\www";
        
          location / { 
          index  index.php index.html index.htm;
       if (!-e $request_filename) {
       rewrite  ^(.*)$  /index.php?s=$1  last;
       break;
        }
     }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       
        location ~ \.php(.*)$  {
            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;
        }
    }
###############以下是留学虚拟主机配置#############
        server {
                listen       80;
                server_name  lx.com;
                root    "D:\phpstudy\PHPTutorial\WWW\liuxue";
                
                
               location / {
                    index  index.php index.html index.htm;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }

               
                location ~ \.php(.*)$  {
                    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;
                }
            }

#留学移动端虚拟主机配置#
        server {
                listen       80;
                server_name  m.lx.com;
                root    "D:\phpstudy\PHPTutorial\WWW\m.welltrend-edu.com\public";
                
                
               location / {
                    index  index.php index.html index.htm;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }

               
                location ~ \.php(.*)$  {
                    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;
                }
            }
########################################
##########################laravel  #
        
            server {
                listen       80;
                #server_name  blog.com;   #暂时关闭这个域名
                #root    "D:\phpstudy\PHPTutorial\WWW\laravel\blog\public";
                
                
               location / {
                     index  index.php server.php index.html index.htm ;
                       try_files $uri $uri/ /index.php?$query_string;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }
                location ~ \.php(.*)$  {
                    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;
                }
               
            }
            #weibo jiekou 
            server {
                listen       80;
                server_name  test.open.lixiaowang.top;
                root    "D:\phpstudy\PHPTutorial\WWW\laravel\blog\public";
                
                
               location / {
                     index  index.php server.php index.html index.htm ;
                       try_files $uri $uri/ /index.php?$query_string;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }
                location ~ \.php(.*)$  {
                    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;
                }
               
            }
            
###################weibo#####################
server {
                listen       80;
                #server_name  test.open.lixiaowang.top;
                root    "D:\phpstudy\PHPTutorial\WWW\2018bak/libweibo-master/";
                
                
               location / {
                     index  index.php server.php index.html index.htm ;
                       try_files $uri $uri/ /index.php?$query_string;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }
                location ~ \.php(.*)$  {
                    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;
                }
               
            }
###################QQ登录#####################
server {
                listen       80;
                server_name qq.open.lixiaowang.top;
                root    "D:\phpstudy\PHPTutorial\WWW\2018bak/qqConnect2.1/";
                
                
               location / {
                     index  index.php server.php index.html index.htm ;
                       try_files $uri $uri/ /index.php?$query_string;
                    if (!-e $request_filename) {
                        rewrite  ^(.*)$  /index.php?s=$1  last;
                        break;
                    }
                }
                
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   html;
                }
                location ~ \.php(.*)$  {
                    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;
                }
               
            }
            
########################################

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

include vhosts.conf;

}

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/112491.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • WSUS客户端访问服务端异常报错-0x8024401f「建议收藏」

    WSUS客户端访问服务端异常报错-0x8024401f「建议收藏」背景:客户反映windows服务器在进行自动更新的时候报错,无法进行更新服务器版本:WindowsServer2012R2StandardIIS版本:8WSUS版本:6.3.9600报错信息:2021-11-2922:15:10:401804cd8WSWARNING:与位于“http://xxxx.xxxx.xxx.xxx:8530/ClientWebService/client.asmx”的终结点进行通信时出现错误。2021-11-…

  • Idea激活码永久有效Idea2020.2.3激活码教程-持续更新,一步到位「建议收藏」

    Idea激活码永久有效Idea2020.2.3激活码教程-持续更新,一步到位「建议收藏」Idea激活码永久有效2020.2.3激活码教程-Windows版永久激活-持续更新,Idea激活码2020.2.3成功激活

  • ScriptManager.RegisterStartupScript 方法

    ScriptManager.RegisterStartupScript 方法1、ScriptManager.RegisterStartupScript方法(Page,Type,String,String,Boolean): 参数page类型:System.Web.UI.Page正在注册该客户端脚本块的页对象。type类型:System.Type该客户端脚本块的类型。通常使用typeof运算符(C#)或GetType运算符(VisualBasic)来指定该参数,以检索正在注册该脚本的控件的类型。key类型:System.String该脚本块的唯一标识符。

  • APACHE REWRITE ? 匹配问号的写法[通俗易懂]

    APACHE REWRITE ? 匹配问号的写法

  • windows安装opencv(opencv安装不了)

    终于实现了在windows下配置Qt和opencv,从刚学opencv尝试,到现在终于配置成功,断断续续经历了一年左右,真实操碎了心。。。走了太多弯路了系统:windows10Qt:Qt5.11.1,mingw5.3版本opencv:3.2.0版本一直有用最新软件的强迫症,这次屈服了,没有使用opencv3.4.2版本,本人尝试了2.7.13版本到3.4.2版本的所有opencv,…

  • mdc和mdio是什么_mdc是哪个国家

    mdc和mdio是什么_mdc是哪个国家在项目开发中,经常会巧妙借助MDC解决链路跟踪、统计耗时等很多问题,通过往期分享的《MDC是什么鬼?用法、源码一锅端》,对MDC有了一个深入的了解,但是细心的同学在项目中,偶尔会发现NDC的身影(可能也从未谋面),那NDC到底是个什么玩意呢?别急,通过今天的分享,能让你轻松get如下几点。1.NDC快速入门;2.NDC与MDC有何不同;3.NDC刨根问底1.ND…

    2022年10月24日

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号