标签:
user surjur; 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 1024; } 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; #gzip on; log_format main ‘$http_x_forwarded_for - $remote_user [$time_local] "$request"‘ ‘ $status $body_bytes_sent "$http_referer"‘ ‘ "$http_user_agent" "$remote_addr" "$upstream_response_time" "$request_time"‘; lua_shared_dict paramcfg 10m; lua_shared_dict appconfig 10m; init_by_lua_file "/home/surjur/works/lua-mobile-api/init.lua"; lua_package_path "/home/surjur/works/lua-mobile-api/?.lua;;"; lua_code_cache off; upstream redis_pool { server 192.168.10.126:8888; keepalive 1024; } server { listen 80; server_name api.cn; root /home/surjur/works/cgtz-mobile-api; index index.html index.php; lua_need_request_body on; location ~* /api/(startUp|newGetKefuTip|newStartImage)(.json|) { proxy_pass http://redis_pool; break; } location ~* /ad/index(.json|) { proxy_pass http://redis_pool; break; } location ~* /app/version(.json|) { proxy_pass http://redis_pool; break; } location ~* /account/getShareTip(.json|) { proxy_pass http://redis_pool; break; } location ~* /project/getRcommendProject(.json|) { proxy_pass http://redis_pool; break; } #charset koi8-r; #access_log logs/host.access.log main; # location / { # root html; # index index.html index.htm index.php; # } #error_page 404 /404.html; # redirect server error pages to the static page /50x.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 / { if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 8888; server_name 192.168.10.126; lua_need_request_body on; location /request_body { # force reading request body (default off) client_max_body_size 50k; client_body_buffer_size 50k; content_by_lua ‘ngx.print(ngx.var.request_body)‘; } location /proxy/{ internal; # proxy_pass http://local.api.cgtz.com/; proxy_pass http://192.168.10.188:45680/phpapi2/; } location / { access_log logs/lua-api-access.log main; error_log logs/lua-api-error.log; content_by_lua_file /home/surjur/works/lua-mobile-api/api.lua; } } }
标签:
原文地址:http://my.oschina.net/surjur/blog/483236