• Nginx添加Lua支持

    日期:

    2 3 4 5 6 wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz tar zxvf LuaJIT-2.0.2.tar.gz make make install PREFIX=/usr/local/luajit2.02 echo /usr/local/luajit2.02/lib /etc/ld.so.conf.d/luajit.conf export LUAJIT_LIB=/usr/local/luajit2.02/...

  • Nginx Lua HTTP客户端

    日期:

    1 git clone https://github.com/liseen/lua-resty-http.git Nginx配置: 1 2 3 4 5 6 7 8 http { llua_package_path /path/to/lua-resty-http/lib/?.lua;;; server { location /test { content_by_lua_file /usr/local/nginx/conf/lua/proxy.lua; } } Proxy...

  • Nginx Lua Proxy

    日期:

    location / { set $bindip ; content_by_lua_file /usr/local/nginx/lua/proxy.lua; } location /proxy { proxy_pass http://$host$request_uri; proxy_bind $bindip; } local action = ngx.var.request_methodif action == POST then method = ngx.HTTP_POS...

  • Nginx Proxy细节问题

    日期:

    1.rewrite使用break结,使用last会对server标签重新发起请求 location /a/ { rewrite ^/a/(.*)$ /b/$1 break; proxy_pass http://www.it.net.cn; } 2.proxy_pass结尾添加/会丢弃路径目录,如下访问/a/test.html会代理到/test.html location /a/ { rewrite ^/a...

  • Nginx rewrite 指令last break区别

    日期:

    nginx 的官方注释是这样的: 1 2 3 4 5 last stops processing the current set of ngx_http_rewrite_module directives followed by a search for a new location matching the changed URI; break stops processing the current set of ngx_http_rewrite_m...

  • Nginx/PHP的SERVER_NAME和HTTP_HOST

    日期:

    SERVER_NAME对应Nginx配置文件中的server_name,通过fastcgi_param设置,如域名指向到IP而不在nginx中设置对应的server_name,PHP取SERVER_NAME为空,如果有多个server_name,取第一个。 1 2 server_name www.haiyun.me; fastcgi_param SERVER_NAME $server_...

  • Nginx配置泛二域名保存为一级域名名称日志

    日期:

    listen 80 default; server_name ~^(.*?\.)*(?domain.[^\.]+?\..[^\.|\d]+?)$; access_log /home/wwwlogs/$domain main; 参考: http://nginx.org/en/docs/http/server_names.html#regex_names...

  • Nginx/PHP-FPM启用Keepalive

    日期:

    Nginx与PHP通信使用TCP连接会造成太多TIME_WAIT及浪费新建连接开销,Nginx新版本增加了对后端启用keepalive功能,有效提高服务器性能。 配置: http { upstream fastcgi_backend { server 127.0.0.1:9000; keepalive 60; } } server { location ~ .*\.php$ {...

  • Nginx官方Centos安装源

    日期:

    #centos6: rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm #centos5: rpm -ivh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm 或自添加: [nginx...

  • The plain HTTP request was sent to HTTPS port

    日期:

    Nginx配置80和443端口在同一server段时不要这样设置: listen 80; listen 443; ssl on; 应该在443端口后添加ssl: listen 80; listen 443 ssl; 有时后端PHP要判断HTTPS: fastcgi_param HTTPS $https if_not_empty;...