Articles of nginx

Nginx和独angular兽

我有两个应用程序,每个运行在独angular兽上。 我想使用nginx作为每个应用程序的前端。 对于每个nginx /独angular兽对,我会使用专用的unix套接字。 为此,我是否需要nginx的实例,或者我可以使用2个虚拟主机吗?

Nginx + uWsgi + Flask无法设置成功

我想在centos 5上使用nginx,uWsgi,Flask,但总是有一些错误。 3应用程序都是最新版本,uwgsi_params文件从uwsgi / nginx复制。 我使用virtualenv来configurationpython env。 project path: /path/to/project virtualevn: /path/to/virenv/pyenv27 第一步: 我使用nginx和uWsgi,并浏览显示错误页面: uWSGI Error wsgi application not found Nginxconfiguration: location / { uwsgi_pass 127.0.0.1:5555; uwsgi_param UWSGI_PYHOME /path/to/virenv/pyenv27; uwsgi_param UWSGI_CHDIR /path/to/project; uwsgi_param UWSGI_SCRIPT uwsgi; uwsgi_param SCRIPT_NAME ""; include uwsgi_params; } 烧瓶文件很简单: import sys sys.path.append(sys.path[0]) from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): […]

error_page似乎不适用于nginx上游指令

我正尝试使用nginx来负载平衡一些下游应用程序服务器,并且如果所有下游服务器都处于脱机或无响应状态,则显示“失败鲸鱼”样式页面。 不幸的是,nginx的文档说,你不能在upstream模块中使用backup指令和ip_hash指令,所以我一直在想办法替代。 现在,我的configuration中的相关块是: upstream appservers { ip_hash; server srv1:8080; server srv2:8080; } server { listen 80; location / { proxy_pass http://appservers; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 5s; error_page 502 503 504 http://failwhale.myapp.com; } } 问题是,如果我closures了两个应用程序服务器,当nginx返回一个502(错误的网关)错误,它似乎使用默认的502错误页面(纯白色的ish)而不是redirect到http:// failwhale。 myapp.com (这也是由nginx服务,绝对是)。 有没有人知道我做错了什么,或者如果这应该是我希望的工作? 如果没有,还有什么可以做的?

NGINX直通式服务器头

如何让NGINX通过上游服务器的“服务器”标题? 就像,如果NGINX代理服务器头部'Apache2.2(CentOS)'的Apache服务器,它将它取出并用'NGINX / 1.0.1'代替它。 我们在我们的Server:头中有我们的机器ID,所以我们需要让NGINX停止覆盖它们。

NGINX在发布到/

在向http://guy.lt/fbb?foo=bar发送post请求{username:'admin', password: 'password'}时发生此问题。 输出是{"foo":"bar"} ,虽然预期的输出是: {"foo":"bar","username":"admin","password":"password"} 。 (PHP后端输出JSON编码的$_REQUEST )但是,如果我直接发送POST请求到http://guy.lt/fbb/index.php?foo=bar ,我得到预期的输出。 所有相关的configuration: https://gist.github.com/98f4e8fc56d1d2d706fd nginx.conf https://gist.github.com/f9a60f3914696dca3374 anuary_standard_server https://gist.github.com/6300bb66620d3731d776 virtualhosts.conf https://gist.github.com/789ad2b0645cade2f9dc anuary_location_php

我应该保持access_log在Nginx中打开吗?

只是从性能angular度思考,可能access_log off; 因为我的网站会提高加载速度(尽pipe它可能是非常小的),但无论如何,无论如何, access_log怎么可以派上用场,真的是因为我已经在我的生活中两次检查访问日志?

Nginx的url映射

现在我有我的网站上运行tomcat,www.domain:11000 / projectName,我想映射时,用户inputwww.domain:10000(会做端口80,但我的ISP阻止端口80,所以我使用端口转发10000- – > 80)我在我的网站上创build了一个新的网站 – 可用代码: server{ location / { include /etc/nginx/conf.d/proxy.conf; } } 并在proxy.conf文件中我有: proxy_set_header Host $host:11000/*projectName*; 当我尝试访问该网站时,它只是给了我一个404。 我究竟做错了什么? 我能做些什么来使它工作。

在Nginx上testingSSL性能

我在CentOS 6 x86_64上运行带有OpenSSL的nginx 1.0.0。 以下是openssl基准testing的结果。 sh# openssl speed aes-256-cbc OpenSSL 1.0.0-fips 29 Mar 2010 built on: Sat Jun 25 04:58:15 BST 2011 options:bn(64,64) md2(int) rc4(1x,char) des(idx,cisc,16,int) aes(partial) blowfish(idx) compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -Wa,–noexecstack -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 […]

实时日志parsing和报告

我们有一个小工程,我们正在兼职工作,在Ubuntu 10.04 LTS服务器上运行在Nginx / MongoDB上。 我们希望能够看到诸如服务器负载,请求/秒,响应时间,数据库负载,数据库响应时间等事情的报告。是否有开源或免费(如在啤酒)工具,可以parsing这样的日志并提供实时报告? 我简要地看了一下Splunk,但是我想看看是否还有其他人强烈推荐。

禁用特定目录中的图像的nginxcaching

我的networking服务器上有一个目录,其中包含我不希望被caching的图片。 Nginx是Apache的前身。 我在nginx.conf中启用了静态资源caching: server { listen 80; server_name www.mydomain.com mydomain.com; location / { root /home/somedomain/public_html/site; proxy_pass http://backend; include /etc/nginx/proxy.conf; } location ~* \.(css|js)$ { root /home/somedomain/public_html/site; add_header Last-Modified: $date_gmt; expires 1y; access_log off; } location ~* \.(jpg|jpeg|gif|png|ico|bmp|swf)$ { root /home/somedomain/public_html/site; expires max; access_log off; } location ~ \.php { proxy_pass http://backend; include /etc/nginx/proxy.conf; } } […]