魏长东

weichangdong

正在查看: 2016年10月日志归档(第 2 页 / 共 18 篇)

openshift 修改http的配置

修改完配置,kill掉进程,然后用以下的命令重启。

我用的是免费的。

/usr/sbin/httpd -C "Include /var/lib/openshift/5785b5c989f5cf177f00009e/phpmyadmin/conf.d/*.conf" -f /var/lib/openshift/5785b5c989f5cf177f00009e/phpmyadmin/conf/httpd_nolog.conf -c  "Include /etc/openshift/cart.conf.d/httpd/*.conf" -c  "Include /etc/openshift/cart.conf.d/httpd/phpmyadmin/*.conf" -D FOREGROUND &
/usr/sbin/httpd -C "Include /var/lib/openshift/5785b5c989f5cf177f00009e/phpmyadmin/conf.d/*.conf" -f /var/lib/openshift/5785b5c989f5cf177f00009e/phpmyadmin/conf/httpd_nolog.conf -c "Include /etc/openshift/cart.conf.d/httpd/*.conf" -c "Include /etc/openshift/cart.conf.d/httpd/phpmyadmin/*.conf" -D FOREGROUND &
/usr/sbin/httpd -c "Include /var/lib/openshift/5785b5c989f5cf177f00009e/php//configuration/etc/conf.d/*.conf" -f /var/lib/openshift/5785b5c989f5cf177f00009e/php//configuration/etc/conf/httpd_nolog.conf -c "Include /etc/openshift/cart.conf.d/httpd/*.conf" -c "Include /etc/openshift/cart.conf.d/httpd/php/*.conf" -D FOREGROUND &
/usr/sbin/httpd -c "Include /var/lib/openshift/5785b5c989f5cf177f00009e/php//configuration/etc/conf.d/*.conf" -f /var/lib/openshift/5785b5c989f5cf177f00009e/php//configuration/etc/conf/httpd_nolog.conf -c "Include /etc/openshift/cart.conf.d/httpd/*.conf" -c "Include /etc/openshift/cart.conf.d/httpd/php/*.conf" -D FOREGROUND &
/usr/sbin/httpd -c "Include /var/lib/openshift/5785b5c989f5cf177f00009e/php//configura" &

git 分支

最近天气项目,测试和正式环境使用两套代码(主要是测试环境测试人员需要保留方便测试的接口,数据传输没有加密)。所以用git创建一个新的branch,通过jenkins配置,
 

测试项目用test的branch,online项目用master。用到的命令大概有
查看本地、远程、所有分支 git branch、git branch -r、git branch -a
创建分支 git branch test
删除本地、远程分支   git branch -d test,git branch -d -r test 删除的时候要是有报错,就加-D
重命名 git branch -m old_name new_name
推送到分支 git push origin test  
切换分之 git checkout test

elastic search扫描模式

function makeLangAction()
    {
        $es = self::connectEs();
        $params = array(  
            "search_type" => "scan",
            "scroll" => "30s",
            "size" => 50,
            "index" => "360weather",  
            "body" => array(  
                "query" => array(  
                    "match_all" => array()  
                )  
            )  
        );  
          
        $docs = $es->search($params);
        $scroll_id = $docs['_scroll_id'];
        $redis = new RedisModel('write');
        echo "all num ".$docs['hits']['total']."\n";
        $num = 0;
        $all_tz = [];
        while (true) {   
            $response = $es->scroll(  
                array(  
                    "scroll_id" => $scroll_id,
                    "scroll" => "30s",
                )  
            );  
            if (count($response['hits']['hits']) > 0) {  
                //loop $response['hits']['hits'] data
                $scroll_id = $response['_scroll_id'];
                //$num += count($response['hits']['hits']); 
                foreach ($response['hits']['hits'] as $tmp) {
                    $tt = explode('_', $tmp['_id']);
                    $loc_id = $tt[0];
                    $data = $tmp['_source'];
                    $lang = $data['lang'];
                    $lang_info = json_encode([
                        'area' => $data['country_code'],
                        'province' => $data['province'],
                        'name' => $data['city'],
                        'tz' => $data['tz'],
                    ]);
                    $tz_num = Functions::computerTz($data['tz']);
                    /*
                    if (isset($all_tz[$data['tz']])) {
                        
                    } else {
                        $all_tz[$data['tz']] = $tz_num;
                    }
                    */
                    $redis->hset(self::REDIS_CITY_ID_WEATHER.$loc_id,self::REDIS_CITY_LANG.$lang,$lang_info);
                    $redis->hset(self::REDIS_CITY_ID_WEATHER.$loc_id,'tz',$tz_num);
                    $num++;
                } 
            } else {   
                break;  
            }  
        }
        
        echo 'tz num '.count($all_tz)."\n";
        print_R($all_tz);
        
        echo "set num ". $num ."\n";  
    }

Nginx Push Stream Module

https://www.nginx.com/resources/wiki/modules/push_stream/

有时间研究下。

lua html模板(win)

set $template_location "/html";   
	set $template_root "D:/openresty/html/html";
	

	
	location /html_html {  
		default_type 'text/html';  
		content_by_lua_file "html/html/test_template_1.lua";   
	}  
	
	location /html_html2 {  
		default_type 'text/html';  
		content_by_lua_file "html/html/test_template_2.lua";   
	} 
	
		
	location /html_html3 {  
		default_type 'text/html';  
		charset utf-8;
		#ngx.header['Content-Type']="text/html;charset=UTF-8"
		content_by_lua_file "html/html/test_template_3.lua";   
	} 

»»阅读全文

nginx+lua+redis三国演义

今天看到redis2_query  redis2_pass,然后网上一看,原来又是nginx的扩展。

以下copy 网路,自己还没有真正搞过。

redis2-nginx-module 是一个支持 Redis 2.0 协议的 Nginx upstream 模块,它可以让 Nginx 以非阻塞方式直接防问远方的 Redis 服务,同时支持 TCP 协议和 Unix Domain Socket 模式,并且可以启用强大的 Redis 连接池功能。

安装lua
# apt-get install lua5.1
# apt-get install liblua5.1-dev
# apt-get install liblua5.1-socket2
安装nginx
# apt-get install git-core
# git clone https://github.com/simpl/ngx_devel_kit.git
# git clone https://github.com/chaoslawful/lua-nginx-module.git
# git clone https://github.com/agentzh/redis2-nginx-module.git
# git clone https://github.com/agentzh/set-misc-nginx-module.git
# git clone https://github.com/agentzh/echo-nginx-module.git
# git clone https://github.com/catap/ngx_http_upstream_keepalive.git
# apt-get install libpcre3 libpcre3-dev libltdl-dev libssl-dev libjpeg62 libjpeg62-dev libpng12-0
 libpng12-dev 
libxml2-dev libcurl4-openssl-dev libmcrypt-dev autoconf 
libxslt1-dev libgd2-noxpm-dev libgeoip-dev libperl-dev -y
# wget http://nginx.org/download/nginx-1.0.8.tar.gz
# tar zxvf nginx-1.0.8.tar.gz
# cd nginx-1.0.8
# ./configure --prefix=/usr/local/nginx --with-debug --with-http_addition_module \
--with-http_dav_module --with-http_flv_module --with-http_geoip_module \
--with-http_gzip_static_module --with-http_image_filter_module --with-http_perl_module \
--with-http_random_index_module --with-http_realip_module --with-http_secure_link_module \
--with-http_stub_status_module --with-http_ssl_module --with-http_sub_module \
--with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl \
--with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module \
--add-module=../ngx_devel_kit \
--add-module=../echo-nginx-module \
--add-module=../lua-nginx-module \
--add-module=../redis2-nginx-module \
--add-module=../ngx_http_upstream_keepalive \
--add-module=../set-misc-nginx-module
# make
# make install
安装lua-redis-parser


# git clone https://github.com/agentzh/lua-redis-parser.git
# export LUA_INCLUDE_DIR=/usr/include/lua5.1
# make CC=gcc
# make install CC=gcc

安装json
# wget http://files.luaforge.net/releases/json/json/0.9.50/json4lua-0.9.50.zip
# unzip json4lua-0.9.50.zip
# cp json4lua-0.9.50/json/json.lua /usr/share/lua/5.1/
安装redis-lua

# git clone https://github.com/nrk/redis-lua.git
# cp redis-lua/src/redis.lua /usr/share/lua/5.1/

»»阅读全文

Nginx 的 Echo 模块 —— echo-nginx-module

这个模块不包含在 Nginx 源码中,安装方法:

1. 首先下载模块源码:https://github.com/agentzh/echo-nginx-module/tags
2. 解压到某个路径,假设为 /path/to/echo-nginx-module
3. 使用下面命令编译并安装 Nginx

$ wget 'http://sysoev.ru/nginx/nginx-1.0.11.tar.gz'
$ tar -xzvf nginx-1.0.11.tar.gz
$ cd nginx-1.0.11/
 
# Here we assume you would install you nginx under /opt/nginx/.
$ ./configure --prefix=/opt/nginx \
--add-module=/path/to/echo-nginx-module
 
$ make -j2
$ make install

»»阅读全文