我有以下的堆栈: (redirecthttp为https =>)https nginx – > varnish – > nginx http – > php5-fpm 当我打开my.url.com时,我立即redirect到https://127.0.0.1 没有清漆,nginx,ssl,php5-fpm(php 5.5)工作得很好… 我认为它与我的清漆configuration有关,因为几乎相同的堆栈运行不同的CMS(TYPO3 Neos)和不同的清漆configuration就好了…(对于nginx的设置几乎是相同的,只是一些轻微的适应,如静态重写) 我很感激你的想法和反馈! 我的nginxconfiguration: # redirect non-www – http and other domains to www – https server { listen 80; ## listen for ipv4; this line is default and implied server_name domain.com some.other.tld; return 301 https://www.domain.com$request_uri; } # […]
首先,我是新的nginx,我正在从Apache切换。 我使用ajenti控制面板设置服务器。 我得到了PHP工作得很好。 然而,当我尝试做一个重写规则,我得到一些奇怪的行为。 我把它放在ajenti控制面板的“自定义configuration”区域。 位置/ bitaddiction { 重写^ / bitaddiction / puzzles /(.*)/bitaddiction/index.php?act=playPage&a=$1 break; } 它很简单,一半的作品。 但是,当我去那个url,我得到一个保存对话框,PHP代码被放在该文件。 我将如何去确保PHP解释它,而不是保存在一个文件?
我有以下nginxconfiguration2个不同的域名: server { listen 80; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; server_name domain.com www.domain.com; location / { try_files $uri $uri/ @route; } location @route { rewrite ^/(.+)$ /index.php?_route_=$1 last; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 我在使用ServerPilot作为我的控制面板的DigitalOcean Ubuntu 14.04 x64液滴上。 […]
我尝试了很多东西,STFW,RTFM,但是我仍然有这个问题。 事情是: 我有一个Nnginx安装在一台AWS机器上(其他的机器安装了它,而不是我),我必须提供几个虚拟主机(* .conf文件)从其他服务器(生产机器) 我的主要问题是这个.conf文件中的error handling程序path是亲戚,例如: html/errores-prxy/handle404.html 如在 location = /handle404.html { root html/errores-prxy; } 问题是为这个处理程序调用的文档根path是/ usr / share / nginx,正如我在错误日志中看到的那样: 2015/04/30 10:33:24 [error] 19542#0: *68 open() "/usr/share/nginx/html/errores-prxy/handle404.html" failed (2: No such file or directory), client: 77.240.116.140, server: www.abengoa.com, request: "GET / HTTP/1.1", upstream: "http://172.26.3.9:80/web/", host: "www.abengoa.es" 在这台AWS机器上,Nginx安装在/ etc / nginx中。 这些处理程序文件位于/etc/nginx/html/errores-prxy/handle404.html 所以我的问题是,如何让Nginx在/ etc / […]
当我的浏览器,我打电话给http://myhost/tiles/yellow/1/2/3.png ,我期望从http://myhost/cache/yellow.png获得内容我的configuration是以下 location /cache/ { alias /my/path/cache/; } location /tiles/ { try_files $uri $uri/ @rulestiles; } location @rulestiles { rewrite "^/tiles/([a-zA-Z1-9]*)/[0-9]{2}/[0-9]{6}/[0-9]{6}\.png$" /cache/$1\.png permanent; } 我错过了什么? 是否因为我不需要所有参数,所以我不使用捕捉function? 我也不想使用符号链接,因为我只需要几百个真正的文件需要数百万的符号链接… 感谢任何指导/帮助
我遇到了一个非常奇怪的情况,Varnish直接打到应用程序服务器(Play服务器),但不能与Nginx一起作为Web服务器。 工作:清漆:6081 =>播放:9000 非工作:清漆:6081 => Nginx:80(播放上游的反向代理)=>播放:9000 Nginx的configuration很简单 location / { <% if env !~ /prod/ -%> ssi on; #turn on ssi proxy_set_header Accept-Encoding ""; # turn on the gzip in the request head request to Play, so the gz can be handled on Nginx <% end -%> proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For […]
最近我发现一些人正试图镜像我的网站。 他们通过两种方式来做到这一点: 假装是谷歌蜘蛛。 访问日志如下: 89.85.93.235 – – [05/May/2015:20:23:16 +0800] "GET /robots.txt HTTP/1.0" 444 0 "http://www.example.com" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "66.249.79.138" 79.85.93.235 – – [05/May/2015:20:23:34 +0800] "GET /robots.txt HTTP/1.0" 444 0 "http://www.example.com" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "66.249.79.154" http_x_forwarded_for地址是google地址。 假装是一个正常的网页浏览器。 我试图使用下面的configuration来阻止他们的访问: 对于问题1,我将检查X_forward_for地址。 如果用户代理是蜘蛛,并且X_forward_for不为空。 然后阻止。 我在用着 map $http_x_forwarded_for $xf { default 1; "" 0; } map $http_user_agent $fakebots […]
我正在尝试处理logstash中的一个nginx访问日志 。 为了让我的时间戳获得毫秒级的准确度,我使用了$msecvariables。 这意味着时间戳的格式1430832725.814 ,其中整数部分是UNIX时间戳,小数部分以毫秒为单位。 不幸的是,我找不到可以parsingUNIX时间戳的logstashdate格式 。 有没有另一种方法让nginx以毫秒的精度进行logging? 或者一种获取logstashdatefilter来parsingUNIX时间戳的方法?
我们使用的是Nginx 1.6.2 + Passenger 5.0.6,并且有一个用PHP-FPM定义的虚拟主机,它提供了一个MODx安装。 只有一个位置/ sinatraapp使用Ruby 2.1.1服务Sinatra应用程序。 设置如下,工作相当好,但我们遇到了一个奇怪的问题。 在向Referer发送请求时,nginx响应403 Forbidden,而Sinatra App / Passenger发回302(302redirect在这种情况下是正确的响应!)。 在没有引用者的情况下执行请求时,它按预期工作。 不起作用: curl -H "Referer: https://www.example.org" https://example.com/sinatraapp 工作: curl -H "Referer: -" https://example.com/sinatraapp 而将Referer-Header完全离开也是可行的。 Sinatra应用程序将302用户到一个MODx subsite example.com/de/something。 Nginxconfiguration: server { listen [::]:443 ssl spdy ipv6only=on; listen 443 ssl spdy; server_name www.example.com; charset utf-8; ssl_certificate /etc/ssl/certs/example_com.crt; ssl_certificate_key /etc/ssl/private/example_com.key; ssl_trusted_certificate /etc/ssl/certs/example_com_bundle.crt; ssl_session_cache shared:SSL:10m; […]
我目前在Rackspace上有4个Web应用程序服务器(在应用程序上运行),位于Load Balancer后面(在Rackspace上)。 在负载均衡器前面。 应用程序本身适度使用caching,所以我知道这可以在很大程度上得到改善。 我目前的架构: RS Load Balancer (SSL Termination) -> 4 Web Servers (Apache) -> MySql 这个设置在我面前已经到位了,现在我有机会清理一些东西,所以我想到了这一点: Varnish -> HAProxy (reverse proxy, LB, SSL Termination) -> 4 Web Servers (nginx) -> Redis / MySql 要么 Varnish -> nginx (reverse proxy, LB, SSL Termination) -> 4 Web Servers (nginx) -> Redis / MySql 或者,在代理之后并在每个Web服务器之前都有更好的清漆: nginx […]