- http://wiki.nginx.org/Install , using ubuntu ppa
apt-get install nginx-extras
apt-get install inotify-tools
nginx -V
# see lua modulewhile true;do inotifywait -e modify -r /etc/nginx/ --exclude .swp --exclude .swo && sudo service nginx reload;done
- test your lua file: http://wiki.nginx.org/HttpLuaModule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if (!window.___is3b) { | |
window.___is3b = "prepare" | |
} | |
function test3b() { | |
window.___is3b = "loading"; | |
var c = navigator.userAgent.toLowerCase(); | |
if (!c.match(/msie ([\d.]+)/)) { | |
window.___is3b = "false"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_cache_path /data/proxy_cache levels=1:2 keys_zone=ui-cache:10m max_size=2048m; | |
server { | |
# api proxy | |
listen 80; | |
# Force cache post data for 3 days. | |
location /xxxx.php { | |
proxy_cache_key "$scheme://$host$request_uri|$request_body"; | |
proxy_cache_valid 200 3d; | |
proxy_cache ui-cache; |
- 修改完nginx配置之后,要运行
nginx -t
检查配置 - lua中的print以notice日志打印到error_log中,所以需要开启notice日志,
error_log /var/log/nginx/error.log notice;
参考: http://wiki.nginx.org/HttpLuaModuleZh#print - body_filter_by_lua可以用于修改响应, ngx.arg[1]为body正文,由于响应可能会分成多段,所以lua代码可能会触发多次,ngx.arg[2]为eof标记,当正文结束时,ngx.arg[2]为true
- 设置lua_code_cache off,可以禁用*_by_lua_file的lua缓存,编辑lua代码之后,不需要reload nginx即可生效,这个指令对于content_by_lua之类写在nginx配置文件内部的lua代码无效。
# backup config, save local.
tar czvf /tmp/openwrt.tgz /etc/config
# reset
mtd -r erase rootfs_data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 ; | |
server_name 127.0.0.1; | |
client_header_timeout 60s; | |
client_body_timeout 30s; | |
send_timeout 60s; | |
#access_log /var/log/redirect.access_log redirect; |
根据这个说明,http://wiki.apache.org/hadoop/HadoopJavaVersions, java可以用openjdk7
sudo apt-get install openjdk-7-jre-headless
其他安装步骤参考这两个链接:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remap prefix to Control + a | |
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
# Base | |
set -g history-limit 30000 | |
set -g status-justify left | |
set-window-option -g utf8 on | |
set-window-option -g automatic-rename on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from fabric.api import task, run, env, cd | |
''' | |
* fab version | |
* fab deploy user:password:version | |
* fab reload_ui | |
''' | |
__author__ = 'notsobad' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
location /secret { | |
access_by_lua ' | |
local function string_starts(String,Start) | |
return string.sub(String,1,string.len(Start)) == Start | |
end | |
local ip = nil | |
local cdn_ip = ngx.req.get_headers()["X-Real-Forwarded-For"] | |
if cdn_ip then |
OlderNewer