Articles of nginx

Nginx的客户端请求最大时间

我有一个Nginx的networking服务器,将代理服务器后面的一些其他的服务器,当我testing一个file upload请求通过行使上限速度调制解调器像速度,我设法保持上载连接至less15分钟。 是否可以限制接收客户端请求体的时间? 我已经尝试client_body_timeout和一堆其他指令,但他们都没有似乎做的伎俩。 keepalive_timeout 65; client_body_buffer_size 16k; client_body_temp_path /var/lib/nginx/tmp/client_body; reset_timedout_connection on; client_header_timeout 8; client_body_timeout 60; client_max_body_size 20M; 对于背景信息,我正在考虑http://httpd.apache.org/docs/2.4/en/mod/mod_reqtimeout.html的 Nginx等价物 HTTP连接是HTTP / 1.1保持连接。 我在Linux上的Nginx的1.4.7。

高性能AWS EC2 / RDS + Nginx + PHP-FPM设置

问题的一般描述 我们目前正在运行PHP的PaaStypes解决scheme上的应用程序。 他们的解决scheme基于AWS云计算,由于他们的计划不适合我们的扩展需求,我们决定直接迁移到AWS,应用程序在每分钟400个请求的应用程序响应中执行“很好”〜100ms在生产中,但在AWS上进行响应需要很长时间。 请记住,这些请求中的每一个都会执行数据库插入+一些计算统计信息的昂贵select。 当前AWS安装尝试 1中RDS服务器(这是不是瓶颈,因为我已经检查)1中型运行nginx + PHP的r3 EC2服务器FPM + Ubuntu的x64 14.04我一直在运行一些基准,并试图模拟我们的正常stream量负载尽可能接近它只是在恒定的负荷下开始行动。 当前使用Config Nginx的 user www-data; worker_processes 2; pid /run/nginx.pid; worker_rlimit_nofile 30000; events { worker_connections 8192; #multi_accept on; use epoll; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay off; keepalive_timeout 30; types_hash_max_size 2048; server_tokens off; # increase buffer and timeouts […]

Nginx的错误:“找不到文件”…来自其他人的域名

我前几天设置了nginx来从Ubuntu EC2实例提供服务,而今天我在浏览器中504之后遇到了504错误日志。 我在我的error.log发现了以下内容: … open() "/var/www/html/ip_json.php" failed (2: No such file or directory), client: 179.99.200.39, server: mydomain.com, request: "GET http://teddybrinkofski.com/ip_json.php HTTP /1.1", host: "www.teddybrinkofski.com", referrer: "none" … 请注意,我没有在这台服务器上的PHP( 特别是不是一个名为ip_json.php的文件),我不是(我也不以任何方式熟悉)teddybrinkofski.com。 这听起来对我来说是个坏消息, 可能妥协的证书? 但是,我也很可能在这个别的处女机器上做了些傻事。 无论如何,我不喜欢这个外域是在我的机器上。 ( grep的领域结果没有意义,但我可能不知道我应该找什么,所以我很高兴与您检讨的结果。) 无论如何,我感觉像我的服务器认为它应该从远程位置拉这个文件,这不太令人愉快。 欢迎大家的来访,如果我忘记了一些重要的事情,请告诉我。

清漆configuration回退到另一个端口

我正在玩不同的configuration设置。 目前我在同一台机器上有80端口的Varnish-cache,70端口的Apache2和90端口的Nginx。 Varnish的configuration方式默认与Nginx通信,例如:config .host = "localhost"; .port = "90"; .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 我的问题是,如果Nginx死了,如何使Varnish fallback到Apache? 使用Apache的Varnish的基本configuration是这样的。 .host = "localhost"; .port = "70" .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 如果第一个configuration失败,我想触发这个configuration(我不能完全放在单词中,但是,如果Nginx死了,我想清除Ping Apache)。 任何关于configuration的提示或build议都会很有帮助。 谢谢。

客户端丢失时closures代理服务套接字

我们正在使用nginx,现在1.6反向代理我们的服务到客户端。 我们还使用Server-Sent Events,这是HTTP之上的一层,可以使套接字保持打开状态。 这是一个需要的configuration。 proxy_buffering off; proxy_http_version 1.1; 这是我们的设置 Client <—> nginx <—> Service Socket 1 Socket 2 当我closures浏览器而没有正确断开连接时,套接字1closures,而套接字2仍然打开。 该服务正在看到nginx仍然连接,并仍然继续在那里推送消息。 这是我用wireshark看到的场景。 Client -XXX- nginx <—> Service Socket 1 Socket 2 有没有办法让nginxclosures套接字2? HTTP的Connection: keep-alive导致任何不良行为?

nginx重写为PHP restful api apache htaccess

我有一个使用Restful API教程的apache htaccess文件 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)$ api.php [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^(.*)$ api.php [QSA,NC,L] </IfModule> 我的nginxconfiguration目前是: server { listen 80; server_name example.org; access_log /var/log/nginx/access.log main; location / { index index.php index.html index.htm; } error_page 404 /404.html; location = […]

如何用nginx托pipeTWiki?

我试图在nginx专用服务器上托pipe一个TWiki( http://twiki.org ),但是我无法设置重写规则来有效地托pipewiki环境。 看这个官方文档:( http://twiki.org/cgi-bin/view/Codev/TWikiOnNginx )我试图使其适应我们的需要,但是这个例子涵盖了维基托pipe在/ twiki地址我想主持它的网站的根源。 现在,如果我把地址栏上的完整地址,例如http://twiki.example.com/bin/view但重写规则应该自动为我做这个。 修改后的configuration运行是这样的: # Start of TWiki specific settings #location ~ ^/ { location / { rewrite ^/([AZ].*) /bin/view/$1; rewrite ^/edit/(.*) /bin/edit/$1; #deny all; allow all; location ~ ^/pub/ { allow all; } location ~ ^/bin/configure { #allow 192.168.0.100; # When you configure your TWiki, remove "#" and set […]

nginx日志logging:有没有办法logging从Unix时代以来的毫秒数的请求时间?

我知道$msec日志logging参数 ,它提供了自毫秒粒度的Unix纪元以来的秒数。 但是,这个格式包括一个时期'。' 例如'1407233265.472',这是我用来parsing日志文件的导入函数的一个问题。 有一种方法(日志参数或插件),将允许请求时间logging总毫秒? 例如'1407233265472'。 很高兴根据需要编译nginx。

请求不会在使用Nginx和PHP-FPM的pm.max_children之后排队

只要池达到pm.max_children,Nginx就会在尝试向PHP-FPM发送新请求时开始超时。 “最大侦听队列”在php状态页面中始终为0。 PHP-FPM 5.5.16 Nginx 1.6.1 这里是一个php-fpm池的例子: [example] catch_workers_output = no ; Configure listener listen = /var/run/php-fpm/example.sock listen.backlog = 65535 listen.owner = nginx listen.group = nginx ; Unix user/group of processes user = nginx group = nginx ; Choose how the process manager will control the number of child processes. pm = ondemand pm.max_children = […]

在nginx上禁用html错误报告

是否有可能完全删除nginx中的HTML错误报告 例如,当我有一个403错误nginx服务如下: <html> <head><title>403 Forbidden</title></head> <body bgcolor="white"> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html> 我使用nginx服务的Web服务,我不需要这个错误报告。 只是http响应代码,没有输出对我来说很好