我如何将真正的访客IP地址转发给Unicorn? 目前的设置是: Haproxy => Nginx => Unicorn 我怎样才能将真正的IP地址从Haproxy转发到Nginx到Unicorn? 目前它总是只有127.0.0.1 我读了X头文件将被放弃。 http://tools.ietf.org/html/rfc6648 – 这将如何影响我们? Haproxyconfiguration: # haproxy config defaults log global mode http option httplog option dontlognull option httpclose retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 # Rails Backend backend deployer-production reqrep ^([^\ ]*)\ /api/(.*) \1\ /\2 balance roundrobin server deployer-production […]
我们在Nginx后面有一个Apache。 Nginx用来在web服务器之间进行负载平衡,并caching静态内容。 唯一的问题是,每次Web应用程序更新时,我们都必须完全清除Nginxcaching(静态文件caching设置为相当高的值,一些静态文件经常改变其他人不)。 有没有一种巧妙的方式让Nginx定期检查文件是否被修改(注意:Apache在响应头文件中返回“Date”),因为时间文件已被Nginxcaching。
我在Apache下面的.htaccess文件redirect所有请求到app/index.php有或没有GET参数。 我刚刚安装了NGINX,我的应用程序将无法运行。 任何人都可以协助在NGINX中复制相同的function吗? 谢谢。 RewriteEngine on Options -Indexes RewriteRule ^$ app/ [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ app/index.php?url=$1 [QSA,L]
我有以下nginx location块: location ^~ /publish { allow 127.0.0.1; #Allow home allow 99.100.101.102; deny all; } 然后这个location块来处理PHP之后: location ~\.php { try_files $uri =404; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; } 问题是,像execute.php这样的/publish类似的文件并没有被fastcgi PHP处理器处理,只是从CURL调用时输出纯PHP代码。 如何执行/publish块中定义的安全规则,但如果文件以.php结尾,仍然执行PHP块?
当我的Web服务器使用端口80时,一个奇怪的查询string被追加到我的访问者去的任何页面,并打破了我的一些服务。 我改变nginx使用端口81,它工作正常,没有附加的查询string。 查询string如下所示: http : //www.site.com/some/url/script.php?COLLCC=2749699728& 在我的代码中没有什么会导致这种情况发生,特别是因为它只发生在端口80上,而不pipe我使用的是什么Web服务器(Apache,Nginx等)。 有没有人有任何想法可能导致这个? 当我做print_r($_SERVER) ,我得到这个: [argv] => Array ( [0] => COLLCC=2693200777& ) [argc] => 1 我正在使用Nginx + PHP-CGI的CentOS 6 64位
这是问题:我有两个域指向服务器上的两个可用的IP。 说: siteone.com指向1.2.3.4,sitetwo.com指向1.2.3.5 我所做的configurationnginx虚拟主机是把 server { listen site1.com:80; # server_name site1.com www.site1.com; 在vhost1文件和 server { listen site2.com:80; # server_name site2.com www.site2.com; 在(单独的)vhost2文件上。 当然,这两个虚拟主机文件是准确复制的,期望site1和site2path。 而且vhost1自己运作良好。 但是,重新启动nginx后,我得到这个错误: 重新启动nginx:configuration文件/etc/nginx/nginx.conf语法正常[emerg]:bind()到1.2.3.5:80失败(99:不能分配请求的地址)configuration文件/etc/nginx/nginx.conftesting失败 当我把 server { listen *:80; # server_name site2.com www.site2.com; 在site2虚拟主机上,nginx重启没有错误,但不会在site2path上呈现页面。 我很困惑,并感谢您的帮助。
请考虑我的根目录中的以下目录结构: /resources/css /resources/js /resources/templates /resources/images 我想从上面的目录服务静态内容,但我也想要这样的重写工作: rewrite ^/([az]+)(.*)$ /index.php?p1=$1&p2=$2; 例如myurl.com/register/…被重写为myurl.com/index.php?p1=register&p2=… 但是这个规则也会重写/resources/ ,那么如何从重写中排除/resources呢? 或者我需要另外重写? 没有任何我试过似乎很明显,我不理解的东西。
我开始了一个ec2实例(微型)来testing我可用来运行一个网站的内存量,但我期待有更多。 所以我的问题是:我需要多lessRAM来运行使用Django,Nginx和Gunicorn的站点。 这是我发现的: 启动Ubuntu 12.04实例将消耗: total used free shared buffers cached Mem: 590 235 354 0 7 182 -/+ buffers/cache: 45 544 Swap: 0 0 0 运行Gunicorn后: total used free shared buffers cached Mem: 590 195 394 0 9 73 -/+ buffers/cache: 112 477 Swap: 0 0 0 所以我有394MB可用,虽然我忘了创build交换卷。 足够运行每月接收3000-4000次访问的论坛吗? 我也将赞赏一些正确的方式来configuration交换的意见。 非常感谢
在处理没有host头部的请求时,我希望Nginx能达到444 。 我已经阅读http://nginx.org/en/docs/http/request_processing.html和Nginx的默认主机时,没有定义 ,它说: "If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server for this port." 我已经configuration好了 server { listen 80 default_server; # Since version 0.8.48, this is the default setting for the server […]
我在我的nginxconfiguration中有以下规则: location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ { 它匹配一些图像和其他资源。 但是我想阻止它匹配在特定目录中uploads 。 如何更改上述规则以防止uploads目录中的文件匹配(如/uploads/something.jpg ),但仍然匹配文件,如/anything/whatever.jpg或只是whatever.jpg ?