Articles of nginx

Nginx共享指令

现在从apache移动到nginx,并将.htaccess重写为nginx。 我有这样的“问题”: 我有大约十个站点,利用相同的核心。 所以我有一堆重写规则应该去其中的每一个。 此外,网站的数量将增加,以及一些共同的规则。 在Apache中,当所有的网站被放置的时候,我已经把所有常用的指令写入了global / www文件夹。 但现在,在nginx我无法确定如何组织configuration文件。 每个网站我都有大约10个通用规则和30个网站规则。 所以不知道如何不写10个常用规则到每个configuration,同时为每个站点提供他自己的规则。 提前致谢。

重新编译的Nginx的1.1.19分块上传,但仍然无法正常工作…

我无法获得大块的上传工作。 即使在重新编译Nginx之后。 我在Ubuntu 12.04上使用nginx 1.1.19。 我下载了nginx 1.1.19的源代码和模块进行分块上传,编译如下。 ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –user=www-data –group=www-data –conf-path=/etc/nginx/nginx.conf –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-log-path=/var/log/nginx/access.log –lock-path=/var/lock/nginx.lock –pid-path=/var/run/nginx.pid –with-debug –with-http_gzip_static_module –with-http_ssl_module –with-sha1=/usr/include/openssl –with-md5=/usr/include/openssl **–add-module=path-to-chunkin-module –with-pcre=/path-to-pre-library.** 编译后,我得到这个: Configuration summary + using PCRE library: /home/www-data/pcre-8.10 + using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library + using system zlib library nginx […]

在Centos 6中将php-fpm设置为umask的最佳位置是什么?

对于Centos 6中的以下两个php-fpm初始化configuration,您认为哪一个最适合放入,例如umask = 077? /etc/init.d/php-fpm 要么 的/ etc / SYSCONFIG / PHP-FPM 任何其他build议也是受欢迎的。 谢谢。

我如何处理Nginx conf中的JSESSIONID

我使用Nginx作为前端服务器,并在它后面一个Apache Http服务器,并begind它一个Glassfish应用服务器:)我的问题是,当我需要一个静态上下文,如; "http://127.0.0.1:8077/directory-web/resources/defaultTheme/images/facebook.png;jsessionid=07ab5b915530738297010cbc0b5c.worker1" 当我请求“ http://127.0.0.1:8077/directory-web/resources/defaultTheme/images/facebook.png ”链接,图像返回我,但nginx不知道什么是JSESSIONID。 在生产中,Glassfish将在两个集群中。 谢谢。

nginx:logging空的电话

nginx是否可以select忽略来自负载均衡器的健康检查或存储桶对节点? 有成千上万的条目 93.190.2.176 – [24 / Jul / 2012:08:56:59 +0200]“ – ”400 0“ – ”“ – ” 在我的access.log中对我无用。 感谢您的提示

负载平衡nginx代理keepalived可能吗?

我想知道是否可以用keepalived来平衡2个nginx代理。 我已经在MASTER – BACKUP设置中用keepalivedbuild立了2个代理的高可用性。 所以故障转移正在工作,但对我来说还不够。 我想要负载平衡这两个代理优选与keepalived,如果它能够做到这一点。 所以(当两个代理都启动时)向VIP发出请求时,请将请求发送到proxy1或proxy2。 Keepalived可行吗? 如果是这样,你知道一个链接,我将不胜感激。 如果没有任何信息会很好。 提前致谢。

为具有自己的域的多个node.js应用程序configurationnginx

我有一个节点的Web应用程序和我的nginx在debian挤压上运行。 现在我想添加一个自己的域名,但是当我这样做,只有第一个应用程序被提供,即使我去第二个域名,我只是被redirect到第一个Web应用程序。 希望你看到我在这里做错了: example1.conf: upstream example1.com { server 127.0.0.1:3000; } server { listen 80; server_name www.example1.com; rewrite ^/(.*) http://example1.com/$1 permanent; } # the nginx server instance server { listen 80; server_name example1.com; access_log /var/log/nginx/example1.com/access.log; # pass the request to the node.js server with the correct headers and much more can be added, see nginx config […]

nginx – 将日志访问和错误logging到pipe道,并使用multiloglogging旋转

我正在做的事:使用multiloglogging旋转nginx访问和错误日​​志 我的方法是:将nginx的访问和错误logging到一个pipe道,这样我就可以有另一个运行multilog的进程来读取该pipe道,并让multilog进行日志轮换 nginx.conf access_log /var/log/nginx/access/pipe; error_log /var/log/nginx/access/pipe; 我确定我创build了pipe道,并给予足够的权限给任何人做任何事情 $ sudo mkfifo /var/log/nginx/access/pipe /var/log/nginx/error/pipe $ sudo chmod a+rwx /var/log/nginx/access/pipe /var/log/nginx/error/pipe 但是,当我启动nginx时,它会挂起,就像它正在等待stdin或其他东西。 我可能在这里错过了一些东西。 我尝试简单的回声pipe道 $ echo a > /var/log/nginx/access/pipe 它也挂起,好像它正在等待更多的input。 也许吧

尝试在Amazon EC2上www重写nginx使我的域的URL不可用

我正在运行nginx版本1.1.19,我有configuration服务器指令来提供不同的页面,取决于是否有人用主机名domain.com(我显示主网页)击中我的服务器,或者他们是否打我的服务器与其他任何(我显示“没有直接的匹配,但你仍然得到这个不错的网页”页面)。 的fileA server { listen 80; server_name domain.com; root /home/ubuntu/http_resources/apex/public; location / { index index.html; } FILEB server { listen 80; server_name ""; #Should catch everything else. root /home/ubuntu/http_resources/otherwise/public; location / { index index.html; } 这两个服务器块configuration都在两个单独的文件中,符号链接到已启用网站。 这符合我的预期。 domain.com – >显示主网页 dummy.domain.com – >显示“无直接匹配…”页面 www.domain.com – >显示“无直接匹配…”页面 问题 我想将www.domain.comredirect到domain.com,但是其他所有子域仍然会出现“No direct matches …”页面。 我创build一个文件包含 fileC: server { […]

长时间运行的请求会阻塞所有后续请

出于某种原因,只要缓慢的请求被处理,nginx就不会接受任何新的请求。 一个简单的testing是用一个sleep()脚本并从不同的浏览器/设备调用脚本。 第一个请求被接受,第二个等待,只有第一个请求完成后才被接受。 有没有解决的办法? nginx.conf user nobody nobody; worker_processes 1; error_log /var/log/nginx-error.log notice; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; # General settings index index.html index.php; sendfile on; server_tokens off; client_max_body_size 10M; # TCP options tcp_nodelay on; tcp_nopush on; # NginxHttpGzipModule gzip on; gzip_buffers 16 8k; gzip_comp_level 5; gzip_disable "MSIE [1-6].(?!.*SV1)"; […]