Articles of nginx

Nginx的上游失败了,如何恢复

从doc: http : //wiki.nginx.org/HttpUpstreamModule#server 它说当上游在max_fails内达到max_fails它将会死亡。 如果我的服务器有时在后面呢? 一般来说, 如果上游服务器发生故障,nginx会重试池中的另一台服务器吗? 任何variables,我可以configuration,以便他们将自动join池中,当他们起来? 谢谢。

nginx默认捕获所有的configuration

我们使用nginx来为dynamic内容提供静态内容和apache。 我已经定义了一个默认的服务器configuration为: #Set a default server that simply proxies all requests to apache server { listen 80 default_server; server_name _; location / { proxy_pass http://127.0.0.1:8080; } } 如果由于某种原因导致server_name不匹配,是否将所有代理都转换为apache的最佳方式?

SSL证书以及通配符通用名称是否将支持domain.com

我从GoDaddy购买了一个便宜的SSL证书。 现在生产中的所有东西都托pipe在www.domain.com 。 当指定通用名称时,通配符(即*.domain.com )会覆盖缺less第三级域名(如domain.com)的情况吗? 可以肯定的是,我为www.domain.com制作了它,而不是通配符。 如果有关系,我将使用nginx和mod_passenger。 如果我想涵盖一切,包括domain.com和staging.domain.com , www.domain.com等,将是一个通配符适当的证书? 便宜的GoDaddy证书(12.99美元/年)是否覆盖通配证书(它似乎不适合我)?

NGINX SSI不工作

我无法让SSI在NGINX上工作。 如果您点击http://www.bakerycamp.com/test.shtml,则可以看到问题。 这是该文件的内容: <!–# echo hi –> 如果你在浏览器中点击这个,你会在内容中看到SSI指令 – 显然NGINX并不解释SSI指令。 我的NGINXconfiguration文件如下所示: server { listen 80; server_name bakerycamp.com www.bakerycamp.com; access_log /var/log/nginx/bakerycamp.access.log; index index.html; root /home/bakerycamp.com; location / { ssi on; } # Deny access to all hidden files and folders location ~ /\. { access_log off; log_not_found off; deny all; } } 我没有从源代码构buildNGINX,而是使用apt-get安装它。 我假设它有SSI模块(因为这是默认的),但也许不是? 我应该硬着头皮从源头上重build吗? 有无论如何告诉安装的NGINX是否支持SSI,我的configuration是错误的?

nginx重装失败:`对象版本不匹配引导参数`

我添加了一个server节到我的virtual.conf ,现在nginx似乎有一个问题重新加载configuration。 在这一点上,我不知道到底是怎么回事,或者如何更好地debugging。 非常感激任何的帮助。 configurationtesting成功: root@server:~# service nginx configtest nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 我在拖尾日志文件。 重新加载时,会logging以下错误。 据我所见,新的configuration不被使用。 root@server:~# service nginx reload Reloading nginx: [ OK ] root@server:~# ==> /var/log/nginx/error.log <== nginx object version 0.8.54 does not match bootstrap parameter 1.0.15 at /usr/lib64/perl5/XSLoader.pm line 94. Compilation […]

有没有办法禁用nginx自动索引目录的符号链接?

我想configurationnginx列出并从一个select目录(自动索引选项)提供批量文件。 但是我担心,如果一个符号链接被意外放置在这样一个目录中,那么文件系统中的所有文件都可能变得暴露在外(例如,通过到/的符号链接)。 有没有办法避免这种情况?

如何统计nginx access.log中的唯一访问者?

我试试这个,但总是返回1。 grep“[10 / Nov / 2012”/path/to/access.log | cut -d“”-f1 | sorting| uniq | wc -l

Nginx编辑php.ini改变没有反映

phpinfo说文件位置是/etc/php5/fpm/php.ini。 附加的.ini文件被parsing/etc/php5/fpm/conf.d/curl.ini,/etc/php5/fpm/conf.d/gd.ini,/etc/php5/fpm/conf.d/mcrypt.ini, /etc/php5/fpm/conf.d/mysql.ini,/etc/php5/fpm/conf.d/mysqli.ini,/etc/php5/fpm/conf.d/pdo.ini,/ etc / php5 / fpm / conf.d / pdo_mysql.ini,/etc/php5/fpm/conf.d/xcache.ini 看他们没有任何处理post_max_filesize或upload_max_filesize的东西。 我在php.ini文件中编辑这个文件并重新启动nginx和php5-fpm服务。 变化不会发生。 这些文件仍然被编辑。 我试过重新启动电脑。 NGINXcaching这个我需要删除的地方,以便使这些更改生效吗? 我已经试过php -i | grep“.ini” 它告诉我php.ini的path是Path => / etc / php5 / cli / phpinfo()告诉我它的/ etc / php5 / fpm / 我编辑都没有运气。 如果我做php -i | grep“post_max”它告诉我它的20M,phpinfo还是说8M。

ModSecurity在nginx上编译错误

我正在尝试在nginx上安装ModSecurity,并提供以下说明: wget https://github.com/SpiderLabs/ModSecurity/archive/master.zip unzip master cd ModSecurity-master ./autogen.sh ./configure –enable-standalone-module 我得到以下错误: Checking plataform… Identified as Linux configure: looking for Apache module support via DSO through APXS configure: error: couldn't find APXS 安装httpd-devel并执行./configure –enable-standalone-module –with-apxs=/usr/sbin/apxs ; make ./configure –enable-standalone-module –with-apxs=/usr/sbin/apxs ; make modsecurity编译工作,但仍有nginx编译的另一个错误: ./configure –add-module=/usr/local/src/john/ModSecurity-master/nginx/modsecurity ,我得到这个错误: gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g […]

如何在Nginx上结合try_files和sendfile?

如果存在的话,我需要Nginx提供文件相关的文件,如果不存在,则回退到上游服务器。 这可以通过如下方式来完成: server { listen 80; server_name localhost; location / { root /var/www/nginx/; try_files $uri @my_upstream; } location @my_upstream { internal; proxy_pass http://127.0.0.1:8000; } } 很公平。 问题是,我的上游没有直接提供URI的内容,而是将X-Accel-Redirect返回到相对于文档根目录的位置(即时生成此文件): % curl -I http://127.0.0.1:8000/animals/kitten.jpg__100x100__crop.jpg HTTP/1.0 200 OK Date: Mon, 26 Nov 2012 20:58:25 GMT Server: WSGIServer/0.1 Python/2.7.2 X-Accel-Redirect: animals/kitten.jpg__100x100__crop.jpg Content-Type: text/html; charset=utf-8 显然,这应该工作。 但问题是,Nginx尝试从一些内部的默认文档根目录来提供这个文件,而不是使用location块中指定的文件: 2012/11/26 18:44:55 [error] 824#0: […]