我目前正在使用express来托pipe我的节点应用程序(在一个简单的代理将它们closures之后) var httpProxy = require('http-proxy'); var http = require('http'); var express = require('express'); httpProxy.createServer(function (req, res, proxy) { var nodeVhosts = ["www.site.com"] var host = req.headers['host']; var port = nodeVhosts.indexOf(host) > -1 ? 8080 //must be a node vhost so pass it to :8080 : 9000; //must be an apache vhost so pass it to […]
我有一个PHP脚本,做一些数据处理。 脚本完成所有工作所需的时间取决于用户的input。 这是不寻常的,需要5-15分钟的处理。 在Apache上一切正常,但在Nginx的连接刚刚closures。 处理时间很less,一切都很好。 问题来源于长期的要求… 没有任何日志中的错误。 我怀疑浏览器closures了连接。 我嗅探了头文件,Nginx似乎没有发送任何响应,直到处理完成。 没有一个头。 我尝试从脚本发送头文件,但似乎nginxcaching所有。 之后,我禁用了PHP输出缓冲并启用了隐式刷新。 我禁用了gzip压缩和zlib。 我将FAST_CGI_BUFFERS最小化为允许的最小值,即:fastcgi_buffers 2 1k; fastcgi_buffer_size 1k; fastcgi_busy_buffers_size 1k; fastcgi_max_temp_file_size 0; 不过,它拒绝发送标题… 所以只是为了certificate我的情况,在代码中的循环之一,我做了一个var_export的对象之一… 繁荣!!! – 有用… 任何人都可以想到更优雅的解决scheme? 谢谢。 8月19日更新 疯狂的事情正在发生。 在我尝试了两天没有任何运气的情况下进行debugging之后,我尝试了一些我以前应该做的事情。 我在Linode上尝试过这个configuration,它工作! 所以可能这个问题是在Ubuntu的configuration…不知道在哪里看。
我在Rackspace的云文件中存储了大量内容,并且需要将这些内容提供给客户端,但安全。 这不是这些超级秘密文件,但把它们放在公共可访问的cdn上是不可接受的。 现在,我正在阅读我的Web框架中的文件并作为响应提供内容。 我宁愿返回一个X-Accel-Redirect头的响应。 问题是您需要24小时后过期的身份validation令牌。 serverfault是什么意思?
目前,当我编译nginx(位于/ home / parth / nginx目录下)时,它将提供的前缀embedded到nginx二进制文件中。 现在,当我移动该文件夹(让我们说到/ tmp),它打破了以下错误消息。 有没有办法configuration日志文件目录? ./nginx -p /tmp/ -c /tmp/conf/nginx.conf nginx:[alert]无法打开错误日志文件:open()“/home/parth/nginx/var/logs/error.log”failed(2:No such file or directory)2012/08/27 02:22: 26 [emerg] 23782#0:/tmp/conf/nginx.conf中的未知日志格式“main”:25 == nginx.conf文件== #user nobody; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr – $remote_user […]
我已经编译nginx与mod_security支持。 在错误日志中,我可以看到对mod_security的支持 2012/08/27 11:13:11 [info] 602096#0:ModSecurity for nginx / 2.7.0-rc2( http://www.modsecurity.org/ )已configuration。 2012/08/27 11:13:11 [info] 602096#0:ModSecurity:APR编译版本=“1.4.2”; 加载版本=“1.4.2” 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:PCRE编译版本=“8.2”; loaded version =“8.02 2010-03-19” 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:加载的PCRE与编译不匹配! 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:LIBXML编译版本=“2.7.8” 我已经加载了ModSecurityConfig和ModSecurityEnabled ModSecurityConfig /usr/local/nginx/conf/modsecurity/modsecurity_crs_41_sql_injection_attacks.conf; ModSecurityEnabled打开; 但我不能让mod_security工作。 攻击可以通过,我不会在日志文件中的错误。 我是否需要添加任何额外的configuration来启用ngix的mod_security? 注意:我使用nginx作为反向代理 谢谢
我有像这样的url: index.php?q=123&w=456&e=789 我需要重写他们的东西,如: index/123/456/789 而不使用“如果”。 到目前为止我已经尝试过: location / { rewrite ^/index.php\?q=(.*)&w=(.*)&e=(.*)$ /index/$1/$2/$3; } 但它不起作用。 有任何想法吗?
有没有什么办法caching响应标题以及在Memcached中的响应正文与Nginx一起使用?
我想重写一些URL在Nginx中,我有一个像这样的URL的WordPress的网站: http://mydomain.com/en/my-content 如何删除en/ with nginx? 非常感谢。 彼得
我想从Apache重写模块转换为Nginx RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) RewriteCond %{QUERY_STRING} SELECT(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} UNION(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} UPDATE(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteRule ^([^.]*)/?$ index.php [L] RewriteRule ^domain/trial/cms$ index/index.php?%{QUERY_STRING} [L] RewriteCond %{HTTP:Range} ([az]+) [NC] RewriteRule ([0-9_\-]+)flv$ http://www.domain.com [R,L] RewriteCond %{ENV:byte-ranges-specifier} !^$ RewriteRule ([0-9_\-]+)flv$ http://www.domain.com [R,L] […]
我试图通过使用端口“1234”连接EC2实例(Windows 2008)上的Nginx。 虽然nginxconfiguration在端口80,443,8090上,但是当我使用一些不同的端口时 – 我无法从远程浏览器连接。 为实例(所有TCP 0-65535)configuration的安全组,Windows上的防火墙已closures。 netstat -ano显示端口1234正在监听,当我启动浏览器时,我可以访问实例。