有些地图杀了我的URI,我不明白为什么: map $http_cookie $redir_scheme { default http; ~some=value https; # here is the SSL cookie } server { listen 8888; server_name redir.*; expires -1; add_header Last-Modified ""; location / { rewrite ^/(.*)$ $redir_scheme://example.com/$1 redirect; } } curl给没有URI的redirect: $ curl -giH 'Host: redir.somedomain.com' 'localhost:8888/some/path/with/meaningful/data' -H 'Cookie: some=value' (…) Location: https://example.com/ (…) 但是当我将configuration更改为: map $http_cookie $redir_scheme { […]
鉴于我在DNS中configuration了2个子域名(所以ping和我的服务器的IP地址都答复)和这些子域名我有2个不同的TLS证书。 我这样configurationnginx: # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the # scheme used to connect to this server map $http_x_forwarded_proto $proxy_x_forwarded_proto { default $http_x_forwarded_proto; '' $scheme; } # If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any # Connection header that may have been passed to this server map […]
我需要传递一些请求来代理(运行GlassFish),删除一段url。 例如: https://xxx.net/jazz/MobileApi?id=2&make_id=4 应该通过代理作为: http://XXXX:8080/MobileApi?id=2&make_id=4 我有以下的Nginxconfiguration: upstream vito_api { server 178.63.XX:8080; } server { listen 80; listen 443 ssl; …. location ~ /jazz/(?<section>.*) { proxy_pass http://vito_api/$section/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 但是,不幸的是,请求传递没有参数。 所以,在GlassFish访问日志中,我只能看到: "148.251.XX" "NULL-AUTH-USER" "05/Jan/2015:15:18:40 +0100" "GET /MobileApi/ HTTP/1.0" 200 21 我做错了什么? 如何传递url参数? 谢谢。
我有一个关于我的服务器块的问题,只有在https上运行的WordPress站点,使用nginx和W3TC浏览器caching。 环境: Ubuntu – 14.04LTS nginx – 1.4.6 PHP – 5.5.9 mysql – Ver 14.14 Distrib 5.5.41 我的问题如下: “地点”部分的顺序是否重要? W3TC块的顺序是否重要? 我已经看到一些“ssl”放在listen指令中,而不是使用“ssl on”。 以后 – 这有什么关系吗? 我处理www =>非www在顶端的服务器块,但我没有明确解决http://domain.com => https://domain.com (强制SSL) – 但它不知何故是这样做的我。 任何想法为什么这是工作,即使我没有告诉它? 我很高兴它的工作,我只是想明白为什么它的工作。 任何其他一般的build议,也赞赏。 谢谢! 虚拟主机configuration: 服务器{server_name www.domain.com; 重写^(。*)https://domain.com$1永久; } server {listen 443 default_server; server_name domain.com; root /usr/share/nginx/html/domain.com; index index.php index.html index.htm; #BEGIN W3TC […]
我注意到,当提供图像时,Nginx使用writev()从Firefox等浏览器调用时发送图像,但使用sendfile()在wgetting图像时发送图像。 任何想法为什么它使用两个? 我有'发送文件; '在configuration中。 任何地方都找不到好的答案。 谢谢!
我使用Nginx作为多个服务器中的多个应用程序的反向代理,我试图将通用caching指令添加到每个应用程序的静态文件。 我原来的configuration是这样的: location /app1{ … proxy_pass http://127.0.0.1:8081/app1; } location /app2{ … proxy_pass http://127.0.0.1:8082/app2; } … 要添加静态文件指令,我可以添加一个嵌套的位置,像这样的每个位置: location /app1{ … proxy_pass http://127.0.0.1:8081/app1; location ~* \.(css|js|ico|gif|jpg|jpeg|png)$ { expires 1d; … proxy_pass http://127.0.0.1:8081; } } location /app2{ … proxy_pass http://127.0.0.1:8082/app2; location ~* \.(css|js|ico|gif|jpg|jpeg|png)$ { expires 1d; … proxy_pass http://127.0.0.1:8082; } } 由于我有像30个应用程序的东西,我试图简化代码如下所示: location /app1{ … proxy_pass http://127.0.0.1:8081/app1; include […]
是否有可能configurationnginx proxy_cache_key包含一个特定的标题作为一个关键而不是只是请求/参数? 我想caching我的API GET命中,并在我的头中使用x-authtoken进行身份validation。 这是目前被忽略,所以如果我离开caching启用,另一个用户将获得以前的用户的caching。
在网上冲浪,我find了许多有关使用Nginx / Confd(或Haproxy或Vulcand)在同一主机上运行的不同Docker容器的教程。 但是,我需要做的是不同的。 在对我的基础设施进行概述后, 一个有5个节点的在线CoreOS集群,全部运行etcd 在集群的每个节点上都启动不同的Docker容器(运行WordPress应用的Nginx web服务器),而不需要暴露一个端口并在etcd上写入他们的ips(Docker检查到的Docker ip)。 如果某个节点closures,我的服务将自动移动到另一个可用节点上 现在,我需要做的是让我们说一个Nginx代理,根据虚拟主机,我的stream量路由到各种容器。 以下例子: Nginx(带pub IP)接收请求xxx.domain.com – > node-1 – >带有自动分配IP的container (监听端口80) Nginx(带pub IP)接收请求yyy.domain.com – > node-2 – > container与自动分配的IP(侦听端口80) 在这里我的问题: 这是我的scheme是正确的? 我在想错吗? 我的Nginx代理必须在CoreOS集群之外? 或者我必须在每个CoreOS节点上运行它? 我怎样才能达到这个configuration? 什么是最好的方法? 先谢谢你!
我目前正在使用Vagrantbuild立一个本地开发的机器。 一切运行,因为它应该期望查询参数不传递给PHP页面上。 这意味着在www.example.com/?a=b上查询参数是可访问的,但在www.example.com/subpage/?a=b则不是。 我发现使用谷歌这个问题的一般答复是修改try_files指令,但这不适合我。 我也检查了php.ini的request_order & variables_order – 所有的东西都在那里正确设置。 这是我的configuration: server { listen 80; server_name example.com www.example.com; root /var/www/public; location / { index index.html index.htm index.php; try_files $uri $uri/ /index.php?$query_string; include /etc/nginx/fastcgi_params; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; } sendfile off; } 由于我对服务器设置和pipe理了解不多,所以我在这里打了一堵砖墙,还是在这里我还检查了一些东西: $query_string在/etc/nginx/fastcgi_params为fastcgi_param QUERY_STRING $query_string; 这对我来说似乎是正确的。 […]
222.186.129.5 – – [19/Jun/2015:16:56:28 +0000] "POST http://123.249.24.233/POST_ip_port.php HTTP/1.1" 301 184 "http://123.249.24.233/POST_ip_port.phpAccept: */*" "Mozi$ 222.186.30.111 – – [19/Jun/2015:16:56:29 +0000] "POST http://123.249.24.233/POST_ip_port.php HTTP/1.1" 301 184 用IP 222.186的POST方法有很多的stream量。 。 所以我有很高的CPU使用率。 我的问题是被袭击的? 如何避免它? (我不想阻止那些IP),而且,我不明白关于日志,它说:“POST http://123.249.24.233/POST_ip_port.php HTTP / 1.0”在正常的POST的URL应该来来自本地但是来自外部。 顺便说一句,我使用nginx,php5-fpm和wordpress,我有这么多的POST到xmlrpc.php,但我已经通过删除和添加规则来解决它。