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;

}

 

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

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

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 掌握Mock摆脱后端同学的束缚

    掌握Mock摆脱后端同学的束缚在开发阶段有一个不成文的规定则是`项目开发后端先行`但是作为前端开发工程师的我们,难道在搭建完页面后只能等待后端的接口么?这样的话我们则完全被后端开发限制住了。

    2022年6月20日
    26
  • 用python生成随机数的几种方法「建议收藏」

    用python生成随机数的几种方法「建议收藏」今天学习了用python生成仿真数据的一些基本方法和技巧,写成博客和大家分享一下。本篇博客主要讲解如何从给定参数的的正态分布/均匀分布中生成随机数以及如何以给定概率从数字列表抽取某数字或从区间列表的某一区间内生成随机数,按照内容将博客分为3部分,并附上代码。1从给定参数的正态分布中生成随机数当考虑从正态分布中生成随机数时,应当首先知道正态分布的均值和方差(标准差),有了这些,…

    2022年10月5日
    1
  • java保留小数_Java保留两位小数的几种做法「建议收藏」

    java保留小数_Java保留两位小数的几种做法「建议收藏」页面或界面上展示的数据保留小数点后两位。为了达到这样的展示效果,本文列举了几个方法:1.使用java.math.BigDecimal2.使用java.text.DecimalFormat3.使用java.text.NumberFormat4.使用java.util.Formatter5.使用String.format……另外可以自己实现或者借用封装好的类库来实现,在这篇文章中…

    2022年9月24日
    0
  • 2、Tomcat集群实战,并用Nginx实现负载均衡(win环境)

    2、Tomcat集群实战,并用Nginx实现负载均衡(win环境)

    2021年6月15日
    80
  • (ExcelVBA编程入门范例)

    (ExcelVBA编程入门范例)很喜爱VBA,喜欢使用她对Excel操作实现所需的功能,更喜欢使用VBA控制Excel以及实现结果后的那种感觉。一直都想对ExcelVBA进行系统的整理和归纳,但由于对Excel及VBA了解得不够深入,总觉得无从下手。再加上又是利用少得可怜的业余时间进行学习,时断时续,学习的主线和思路也经常因为工作或其它的事情而打断。但喜欢学习的人总会挤得出时间来的,要想掌握或者是精通一门知识和技术不能有任何借口

    2022年6月6日
    50
  • WPA2 KRACK Attacks 原文转载翻译[通俗易懂]

    WPA2 KRACK Attacks 原文转载翻译[通俗易懂]写在前面:博主水平有限,翻译中如果出现错误,还希望大家能够指正。原文链接:https://www.krackattacks.com/KeyReinstallationAttacks(krack)key重装攻击简介我们发现了关于WPA2的重大漏洞,WPA2是一个确保所有现代无线网络被保护的协议。当攻击者在受害者的一定范围内就可以利用这些漏洞来使用KRACK攻击。具体地说,攻

    2022年5月1日
    64

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

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