• 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;...

  • Nginx [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)

    日期:

    Nginx [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use) Nginx更新后经常遇到这样的问题,解决方法: fuser -k 80/tcp /etc/init.d/nginx start 或 killall -9 nginx /etc/init.d/nginx start...

  • Docker v1.13.0-rc4 发布,应用容器引擎

    日期:

    Docker v1.13.0-rc4 发布了。Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app)...