Articles of nginx

Varnish,Nginx,Apache,APC,Meteor,Cpanel&WordPress单服务器上,有什么好处?

是的,我已经阅读了许多密切的问题,但我需要一个具体的答案,因此这个问题。 首先,这些是我的新服务器规格: Linux服务器(CentOS),英特尔至强3470四核(2.93GHz x 4)处理器,4 GB DDR3内存,1 TB硬盘空间,10 TB带宽和9个专用IP。 目的:加快我的WordPress博客+提高服务器处理重负载的能力 计划:这是我计划设置我的服务器 – – VARNISH (在前面,caching服务器响应)>> NGINX (有效处理静态内容和克服C10k问题 )>> APACHE (背后Nginx,有效地提供dynamic内容)>> APC (PHP页面,数据库和对象caching)>> CPANEL (需要Apache,我需要它)>> WORDPRESS >> W3 TOTAL CACHE (WordPress的caching插件)。 那么,安装程序会工作吗? 有没有人试过? 请淋浴你的想法和知识。 注:我不能没有Apache,因为我习惯了.htaccess和Cpanel的东西。 所以,这不是任何选项。 所有其他人都是select。 请尽量帮忙。 我希望我清楚我想问什么。

nginx导致504错误,但我的应用程序仍在运行

因此,我们使用Node.js来为CompassionPit.com提供动力,并且全部由nginx提供。 nginx正在抛出一个504网关超时 有趣的是,如果我导航到http://compassionpit.com/index.html ,那么我可以访问该页面(我相信所请求的是通过端口8000上运行的节点应用程序路由)。 和http://compassionpit.com/blog/正在工作。 但http://compassionpit.com/已closures。 🙁 帮帮我? root@li70-243:~# cat /etc/nginx/sites-enabled/blog server { listen 80 default; # your server's public IP address server_name compassionpit.com; index index.html; location /blog/wp-content/ { alias /opt/blog/wp-content/; } location /blog/ { root /opt/; include fastcgi_params; fastcgi_pass localhost:8080; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location / { alias /opt/chat/static/; if (-f $request_filename) […]

为许多并发用户configurationphp5-fpm

编辑:增加了一些configuration和澄清多less是“多”,按anthonysomerset的要求。 编辑2:添加fastcgi_cache到nginxconfiguration,如由SleighBoybuild议。 我为一个朋友的网站运行一个服务器,时不时会有大量的stream量,大约有200-300个并发用户。 在尖峰之间,服务器有大约70-80个并发用户,并且没有麻烦地处理stream量。 该网站运行在与Debian Squeeze,Nginx,PHP5-FPM + APC(128MB),MySQL 5,memcached(128MB)和Varnish(1GB)的服务器上的W3 Total Cache。 parentesis中的数量是我为它们各自的caching分配了多less。 内存永远不会超过1.8 GB afaik,但可能会有点超额预定。 虽然通常不会造成任何问题 造成这个问题的原因总是PHP5-FPM利用100%的CPU一段时间,然后只是崩溃,导致nginx吐出502错误。 日志build议增加最大的孩子数量,但我想我已经达到了服务器可以处理多less个孩子的限制。 我一直在使用pm.max_requests (0(无限)),但是现在将其设置为1000,以查看重新产生的孩子现在是否可以提供帮助。 /etc/php5/fpm/pool.d/www.conf [万维网] listen = /var/run/php5-fpm.sock user = www-data group = www-data 下午=dynamic pm.max_children = 200 pm.start_servers = 20 pm.min_spare_servers = 20 pm.max_spare_servers = 60 pm.max_requests = 1000 /etc/nginx/nginx.conf 用户www-data; worker_processes 8; pid /var/run/nginx.pid; 事件{ worker_connections […]

隐藏/replaceNginx位置标题?

我正在尝试通过一项PCI合规性testing,并且我正在得到一个“高风险漏洞”。 问题描述如下: Web服务器所在机器上的信息有时会包含在网页的标题中。 在某些情况下,这些信息可能包含防火墙或代理服务器(如本地IP地址)后面的本地信息。 看起来Nginx正在响应: Service: https Received: HTTP/1.1 302 Found Cache-Control: no-cache Content-Type: text/html; charset=utf-8 Location: http://ip-10-194-73-254/ Server: nginx/1.0.4 + Phusion Passenger 3.0.7 (mod_rails/mod_rack) Status: 302 X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7 X-Runtime: 0 Content-Length: 90 Connection: Close <html><body>You are being <a href="http://ip-10-194-73-254/">redirect ed</a>.</body></html> 我不是专家,所以请纠正我,如果我错了,但从我所收集的,我认为问题是Location标题返回http://ip-10-194-73-254/ ,这是一个私人地址,当它应该返回我们的域名(这是ravn.com)。 所以,我猜我需要隐藏或replaceLocation标题不知何故? 我是一个程序员,而不是服务器pipe理员,所以我不知道该怎么办…任何帮助将不胜感激! 另外,我可以补充说,我们运行的服务器不止一台,所以configuration需要转移到任何具有私有地址的服务器上。

如何在nginx上添加一个新的网站到fastcgi-mono-server4进程,而无需重启现有的网站?

我知道这可能是相关的,但我有一个脚本,加载configuration文件上定义的网站fastcgi单一服务器,我需要一个新的网站到池,而无需重新加载所有fastcgi进程。 干 nginx -s reload 只需重新加载每个服务器(网站)configuration,我需要一个更stream畅的过程来添加一个新的asp.net网站到当前的工作进程。

nginx proxypass监视链接

我试图设置Nginx使用proxy_pass转发请求到几个后端服务。 加载https://example.com/monit作品,但是页面内的链接是https://example.com/sshd而不是https://example.com/monit/sshd 我正在运行监视器5.2.5 我已经尝试过,没有下面的重写规则。 configuration文件; proxy.conf location /monit { # rewrite /monit/(.*) /$1 break; proxy_pass http://localhost:2812/; include proxy.inc; } …. more entries …. /主启用的站点 – server { listen 443; server_name example.com; server_name_in_redirect off; include proxy.conf; ssl on; } proxy.inc proxy_connect_timeout 59s; proxy_send_timeout 600; proxy_read_timeout 600; proxy_buffer_size 64k; proxy_buffers 16 32k; proxy_pass_header Set-Cookie; proxy_redirect off; proxy_hide_header […]

nginx,php-fpm和多个根 – 如何正确try_files?

我有一个根源于login应用程序的服务器上下文。 如果login成功,login应用程序会处理login,然后在同一台服务器上将redirect返回到“/ app”。 该应用程序被植根于其他地方,由此处显示的位置块处理: location ^~ /app { alias /usr/share/nginx/www/website.com/content/public; location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/tmp/php5-fpm.sock; include fastcgi_params; } } 这工作得很好,但是传递给PHP的$ uri仍然包含/app ,尽pipe我使用的是别名而不是root。 正因为如此, try_files指令不能成为404除非我在/usr/share/nginx/www/website.com/content/public链接app -> ./ 。 在那里build立链接显然是愚蠢的,如果这个链接永远丢失了,那么没有明显原因的网站就会死掉。 接下来我尝试了… 是完全删除了try_files指令。 这使我可以在我的/public文件夹中的app链接,PHP没有问题的位置和执行文件。 我用它来从PHP中转储我的$_SERVER全局,当浏览器URI是/app时,发现"SCRIPT_FILENAME" => "/usr/share/nginx/www/website.com/content/public/index.php" /app "SCRIPT_FILENAME" => "/usr/share/nginx/www/website.com/content/public/index.php" /app "SCRIPT_FILENAME" => "/usr/share/nginx/www/website.com/content/public/index.php" 。 这是完全正确的 。 基于我的fastcgi_params下面,这使我相信try_files $request_filename =404; 应该工作,但没有骰子。 nginx仍然没有find该文件,并返回404。 所以现在,它只会在没有任何try_files指令的情况下工作。 […]

nginx块如果包含中断

希望阻止在nginx中包含以下string的任何请求 '%0d','%0a','%0D','%0A' 只是真的想要返回像500错误或这样的..没有什么幻想

代理到“后端”服务,只要文件不存在

我正在使用NGINX来提供静态文件。 每当一个文件不存在时,我希望NGINX能够尝试asynchronous检索该文件的nodejs后端服务。 后端服务需要3个参数: GUID ,文件的大小和扩展名 。 所有这些参数都是使用正则expression式从原始请求中检索的。 这是我目前的NGINXconfiguration文件: server { listen 80; server_name .example.com; root /var/www; ## Serves file (matching pattern: /<size>/<MEDIA>/<file na-me><.ext>) location / { location ~* ^/(\d+x\d+)/(([\w])([\w])([\w])[-\w]+)/[^\.]+\.(\w+)$ { try_files /$3/$4/$5/$2/$1.$6 @backend/$2/$1/$6; } } ## backend service location @backend { proxy_pass http://127.0.0.1:8080; } } 但是我一直得到这个错误: 2012/01/23 11:53:31 [error] 28354#0: *1 could not find named […]

Nginx将一个位置块redirect到另一个位置块

对于以/ c /开头的uri,我想要做一个memcached密钥testing,如果存在,则返回密钥的值。 如果没有密钥,它应该通过代理。 我用这个指令来做: location ^~ /c/ { set $memcached_key "prefix:$request_uri"; memcached_pass 127.0.0.1:11211; default_type application/json; error_page 404 405 502 = @proxy } 对于所有其他请求,我希望它们传递给相同的代理。 我用下面的指令来做: location / { proxy_pass http://127.0.0.1:5555; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for; } 而我的@proxy位置是这样的: location @proxy { proxy_pass http://127.0.0.1:5555; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real_IP […]