我们在我们的Web应用程序前面有一个NginX平衡代理。 不幸的是,没有足够的开发资源来支持过时的浏览器,但是:(我们希望通过浏览器的用户代理数据( https://www.in2circle.com/outdated )将我们的web项目的成员redirect到/过期的页面,出于某种原因,我们不想用User-Agent内容分析逻辑加载后端。我听说用NginX很容易处理http://nginx.org/en/docs/http/ngx_http_map_module.html如果有人这样做,请你帮助我的例子和解释,请!
不知何故,谷歌已经通过IP地址和域名索引我的网站。 例如,180.10.1.1/index.php以及www.mysite.com/index.php 我想301所有这些IP地址的url到相应的主机名url,但不知道如何在nginx.conf中做到这一点。 感谢您的帮助…
我一直想用PHP-FPM来试用Nginx。 我通过Macports安装了Nginx。 我读到PHP 5.3.3包含PHP-FPM,但Macports上的PHP 5.3.3configuration不支持。 任何人都可以解释或转介我如何在OS X上安装PHP-FPM for Nginx的PHP 5.3.3教程吗? 我希望把它放在/ opt中,Nginx将使它远离我在/ usr / local下使用Apache的PHP。 我是新手到命令行的东西。 请原谅我的无知
我正在尝试将所有来到“ http://example.com/something ”url的用户redirect到“ http://answares.com/examples_com/something ”之类的url。 我试着用这样的代码: server { listen 1.2.3.4:80; server_name "example.com"; rewrite ^(.*) http://answares.com/examples_com$1 permanent; } 通过访问“ http://example.com/ ”我被redirect到“ http://answares.com/examples_com/ ”,但通过访问“ http://example.com/something ”,我被redirect到:“ http ://answares.com/something “。 我试图以不同的方式做到这一点,但我得到的最好的是: http://answares.com/examples_com//something 这是因为两个斜线看起来跛脚。 我在Ubuntu 10.4上使用Nginx 0.7.65
希望实现与40-50人和客户峰#用户的办公networking,我认为nginx可以作为一个透明的代理caching请求到任何基于HTTP的网站在networking边缘。 这可能吗? 如果是的话,怎么样? 我试过Googlesearch,但似乎所有的资源似乎指向托pipe自己的服务器和caching请求。 但是,我们也将在这个networking中托pipe服务器,所以nginx将被用来将请求路由到这些networking。 那么,如何将nginx设置为对互联网服务器请求的透明代理,并且可以将代理服务器调用到我们的Web服务器?
我需要根据用户代理将stream量redirect到一个后端或另一个后端。 这是正确的事情吗? server { listen 80; server_name my_domain.com; if ($http_user_agent ~ iPhone ) { rewrite ^(.*) https://m.domain1.com$1 permanent; } if ($http_user_agent ~ Android ) { rewrite ^(.*) https://m.domain1.com$1 permanent; } if ($http_user_agent ~ MSIE ) { rewrite ^(.*) https://domain2.com$1 permanent; } if ($http_user_agent ~ Mozilla ) { rewrite ^(.*) https://domain2.com$1 permanent; } }
在我的http指令中使用单个文档根时,一切正常。 但是,我想添加一个额外的指令位置指令,我不能让fastcgi这个额外的根(我访问http:// localhost / sqlbuddy时,我收到一个白页)。 这是我的nginx.conf的摘录: server { root /home/tman/dev/project/trunk/data; index index.php; location /sqlbuddy { root /srv/http; index index.php; } location ~* \.php { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } } 而我的fastcgi.conf: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; […]
这里是包含静态HTML文件的目录 public |– index.html |– media | `– blurred_image-8.jpg |– post | `– 13considerations | `– index.html 我正在尝试configurationnginx来转换所有以.html结尾的url.html后缀。 喜欢这个:- server { listen 80; server_name mysite.com; location / { root /var/www/mysite/public; try_files $uri $uri/ $uri/index.html; } location /media/ { alias /var/www/mysite/public/media/; error_page 404 = /404; expires 30d; } location /static/ { alias /var/www/mysite/public/static/; error_page 404 = […]
我在远程服务器上的端口80到8000上的nginx中做了一个proxy_pass ,然后从远程端口转发到我的本地主机,从8000到80端口。 这很好,但我也想用https来做,但似乎nginx需要一个有效的证书来传递stream量。 有没有办法让我的远程服务器简单地转发从端口443 trafic说8443(然后我将转发远程8443本地443)。 然后在我的开发机器上终止ssl而不是在远程服务器上执行它? 我的远程运行的Ubuntu和我的本地主机运行OSX 。
我有以下设置并configuration为发送所有/ api请求到不同的服务器: location /api { proxy_pass https://myapp.herokuapp.com; rewrite ^/api/(.*) /$1 break; } 我的应用程序发送一个头(USER_CUSTOMER),当它直接与myapp.herokuapp.com进行通信时,它的工作,但是通过代理服务器请求时,API值上显示NULL。 下面在NGINX中有效,但是我需要App能够设置USER_CUSTOMER的值。 location /api { proxy_pass https://app.herokuapp.com; proxy_set_header USER_CUSTOMER ABC; rewrite ^/api/(.*) /$1 break; } 我可能会在将来发送额外的头文件,所以我希望有一个标志将所有头文件从代理传递到API服务器。 Ubuntu nginx/1.1.19