yangkai/server-code-version

此包的最新版本(v1.1)没有提供许可信息。

项目块测试

v1.1 2019-12-27 02:34 UTC

This package is auto-updated.

Last update: 2024-09-27 13:58:56 UTC


README

##版本区分插件是利用nginx服务来映射项目方便快捷替换项目版本测试

###1.nginx的配置


server {

        listen 80;
        server_name  localhost;
        index index.php index.html;
        #设置你的项目名称
        set $project "version";

        #HTTP版本配置
        if ( $http_server_code_version = "" ) { 
                set $http_server_code_version "master";
        }
        
        location /server-version {
                try_files $uri $uri/ /index.php;
        }
        
        #设置项目目录
        set $rootPath "/www/project/${project}/${http_server_code_version}";

        #php配置
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            #SERVER_CODE_VERSION 是php用来区分你的版本号的必须配置
            fastcgi_param  SERVER_CODE_VERSION $http_server_code_version;
            include        fastcgi_params;
        }

        root $rootPath;
                
        #之后的配置根据项目自定义
        location / {
                  # Redirect everything that isn't a real file to index.php
                try_files $uri $uri/ /index.php?$args;
        }

    }

###2.使用方式

  • 在http header头部中设置server-code-version来控制版本(默认是master版本)
  • 通过访问你的 http://域名/server-version 来设定所需的版本,这是此控件的主要操作方式