我有一个nginx实例,具有以下configuration: server { listen 80; server_name mySite.com; location / { root /usr/share/nginx/html; index index.html index.htm; } } server { listen 80; server_name jenkins.mySite.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://107.170.102.140:8082; } } 当我尝试导航到jenkins.mySite.com,似乎加载静态index.html页面。 这不是redirect到我的jenkins(107.170.102.140:8082)实例。 任何我可能做错的想法? 编辑:根据浏览器和networking,我有时可以访问jenkins子域。 这几乎就像是一场竞赛。 我能够在Chrome中加载Jenkins,但之后立即切换到IE,并加载了默认的静态页面。
我在Ubuntu 14.04上运行GitLab 7.9.2 c46d4f5(Omnibus) 当有人导航到一个提交gitlab返回时,我们有一半以上的提交 500我们很抱歉,但是出了点问题 另外,在不返回500的提交中,它们需要5到20秒的时间来显示页面。 我正在观察所有的日志,因为这是正在发生的事情,没有什么突出的问题正在发生。 当我去一个返回500错误的提交,nginx日志返回: 192.168.1.x – – [27/May/2015:09:35:44 -0500] "GET /project/module/commit/6876452e1df1d2846dhd1b2eb7d907e6ae8hf7d5 HTTP/1.1" 500 349 "https://gitlab.company.com/project/module/commits/staging" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36" 还有一些事情正在发生,我不确定是否正常是在nginx日志中每隔3到5秒我就会得到: 192.168.1.y – – [27/May/2015:09:40:06 -0500] "POST //api/v1/builds/register.json HTTP/1.1" 404 27 "-" "-" 192.168.1.y是一个gitlab ci亚军,我认为3-5秒的联系是某种forms的存活,但我绝对不知道。 任何帮助表示赞赏,没有其他日志显示任何错误,或任何奇怪的。 我已经检查过独angular兽,sidekiq,nginx和postgresql。 作为一个侧面说明,我仍然可以访问UI通过terminal提供的所有统计信息,但是我有很多喜欢使用UI的用户。 另外需要注意的是,这是一个在Hyper-v 2012上运行的虚拟机,并且已经从这些指令安装了linux工具。 话虽如此,我真的不认为这是与gitlab以外的任何问题。
我们目前正在使用ngx_http_realip_module来转换CF IP的回到用户的。 它在大多数情况下运行良好,但是我们的access.log中的一些ips仍然来自CF. http {}中的当前configuration: #CloudFlare set_real_ip_from 199.27.128.0/21; set_real_ip_from 173.245.48.0/20; set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.31.4.0/22; set_real_ip_from 141.101.64.0/18; set_real_ip_from 108.162.192.0/18; set_real_ip_from 190.93.240.0/20; set_real_ip_from 188.114.96.0/20; set_real_ip_from 197.234.240.0/22; set_real_ip_from 198.41.128.0/17; set_real_ip_from 162.158.0.0/15; set_real_ip_from 104.16.0.0/12; set_real_ip_from 172.64.0.0/13; real_ip_header X-Forwarded-For; #real_ip_header CF-Connecting-IP; https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx- 什么会导致一些IP不能被转换? 谢谢!
我目前正在设置nginx + gunicorn来服务一个django应用程序,这个应用程序将被最多60个用户使用。 该应用程序是非常基本的,6个Django表格由10个字段和10个报告页面提交的答案。 以及以csv格式导出响应的能力。 使用本教程中提供的默认configuration,使用3名worker的gunicorn,并使用postgresql默认configuration,而不进行任何调整,系统可以处理多less个并发用户? 我一直在试图用围攻来模拟并发用户,但我不确定这是否是检查并发用户的正确方法。 是否还有其他工具可用来更好地了解有多less用户可以处理?
我想将https://subdomain.example.comredirect到https://example.com 。 这就是我想要的: server { listen 443 ssl; server_name subdomain.example.com; return 301 $scheme://example.com$request_uri; } server { listen 443; server_name example.com; ssl on; ssl_certificate /path/to/crt; ssl_certificate_key /path/to/key; # … } 去https://example.com请求是好的,但https系统地请求到子域名超时。 有任何想法吗?
我已经在这个问题上运行了几天。 除了通常的系统/安全更新之外,我没有进行configuration更改。 服务器在Debian Wheezy上运行 PHP 5.4.41-1〜dotdeb + 7.1 Nginx 1.8.0-1〜dotdeb + 7.1 我正在运行一个PHP / Postgresql应用程序。 Nginx在chrooted环境中使用php-fpm。 我花了一些时间来隔离我的用户上周开始得到的504错误网关错误的原因。 php-fpm的日志显示了那种错误: 2015/05/28 15:19:32 [error] 6393#6393: *792 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 90.50.31.149, server: www.myhost.com, request: "POST /myapp/?page=account&password HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.mypool.sock", host: "www.myhost.com", referrer: "https://www.myhost.com/myapp/?page=account&password" 经过一番Googlesearch之后,我提出了php-fpm的能力: pm.max_children = 70 pm.start_servers […]
看了很多相关的post,大部分都指向了一个过时的版本的python,在uwsgi启动过程中导致了'no module named os'。 我跑了 print sys.version_info 它显示了Python 2.7,所有其他来源说,这是足够新的。 我的.ini文件看起来像: [uwsgi] chdir = app/app/ module = wsgi.py:application no-site = true virtualenv = app_venv master = true processes = 10 socket = app.sock chmod-socket = 777 vacuum = true die-on-term = true 而当我运行: uwsgi –ini app.ini 我懂了: Traceback (most recent call last): File "./wsgi.py", line 10, […]
用下面的方法挣扎一下。 为JS和CSS添加过期,加上其他静态文件很容易: # Directives to send expires headers. location ~* \.(?:css|js)$ { expires 28d; access_log off; add_header Cache-Control "public"; } 但是对于我喜欢的url,我不太清楚。 重写的URL如下所示: www.domain.tld/post-name 所以没有像.html或.php这样的扩展名,而主页只是一个/注意我的主页是静态的,没有最新的新闻/博客文章等,所以我也希望这个caching在浏览器中。 将过期添加到此位置块不会将浏览器caching添加到主页: location / { try_files $uri $uri/ /index.php?$args; expires 1d; } 在php文件位置添加过期(重写之前)也不起作用,Nginx似乎想要确切的请求的URI。 我已经看到了这个build议,但是对使用太多的if语句表示谨慎: location / { if (-f $request_filename) { expires 30d; break; } } 什么是最好的方法来确保这样一个简单的5页面网站获取所有的页面浏览器caching? 理想情况下不需要对url进行硬编码。 www.domain.tld / www.domain.tld / […]
默认情况下,Nginx的upstream指令使用Round-Robin将请求分发给后端realserver,并按权重设置服务器的weight 。 但是我没有看到任何有关ip_hash是否也适用于ip_hash 。 有些人认为weight不适用于ip_hash ,但我已经在太多的博客文章中看到过这个例子。 问题 那么nginx-sticky-module呢? 严格使用cookie粘贴来分配请求,忽略重量或weight Nginx首次处理客户请求?
我有一个工作在fastcgi config在nginx中。 现在我有很less的要求/X , /X /X.php处理/Y.php /Y听起来很简单,所以我写了下面的testing: rewrite ^/X.php$ /api/v1/stat last; 它被PHP应用程序的404处理程序捕获。 这里是rewrite_log的nginx错误日志 [notice] 15289#0: *759 "^/X.php$" matches "/X.php", client: 10.0.0.12, server: example.com, request: "GET /X.php HTTP/1.1", host: "example.com" [notice] 15289#0: *759 rewritten data: "/api/v1/stat", args: "", client: 10.0.0.12, server: example.com, request: "GET /X.php HTTP/1.1", host: "example.com" [notice] 15289#0: *759 "^/X.php$" does not match "/index.php", […]