在Cent OS上configurationNginx和Tomcat服务器时遇到问题。 这里是nginx.conf : server { listen 80; server_name subdomain.test.com; root /usr/local/tomcat/webapps/webapp_folder; index index.html index.htm index.jsp; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location ~ \.jsp { proxy_pass http://127.0.0.1:8080; } } 当我访问subdomain.test.com时 ,我会得到一个下载对话框而不是index.jsp的内容。 另外,我可以通过访问ip_address:8080 / webapp_folder来访问网站。 我也尝试将URL http://127.0.0.1:8080更改为http://127.0.0.1:8080/webapp_folder ,但是当我启动Nginx时,出现以下错误消息: 重新启动nginx守护进程:nginxnginx:[emerg]“proxy_pass”不能在正则expression式给出的位置,或命名的位置内,或者if语句内,或者在/etc/nginx/nginx.conf中的“limit_except” :145 我也试过这个: server { listen 80; server_name subdomain.test.com; root /usr/local/tomcat/webapps/webapp_folder; index index.html index.htm […]
我使用nginx作为CouchDB的反向代理。 我想为代理使用前缀,例如http://[ip]:8080/proxy/testdb – > http://localhost:5984/testdb 。 我得到了HTTP响应中的Location: headers,它们导致我的HTTP客户端redirect并中断。 我怎样才能修复我的nginxconfiguration? 我的nginx服务器块如下所示: server { listen 8080; root /var/www/proxy; index index.php index.html index.htm; location /proxy { rewrite /proxy/(.*) /$1 break; proxy_pass http://127.0.0.1:5984; proxy_redirect off; # proxy_set_header Host $host; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } HTTP响应示例: HTTP/1.1 201 Created Server: nginx/1.6.2 Date: Tue, 13 Jan 2015 01:09:00 GMT Content-Type: […]
当我发现访问者是一个爬虫(给SEO优化的网站)和一个标准的php fast-cgi实例(通过fastcgi pass)时,我有一个特定的情况,我想将访问者redirect到“prerender”除此以外。 我对nginx的经验非常稀less,所以我无法完成我所需要的。 这是我当前configuration的草稿 server { server_name example.com; root /vagrant/example.com/web; index app.php; location /phpmyadmin { root /usr/share; index index.php; location ~* \.php { fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; } } location / { try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } […]
我们有一个Tomcat 7在8080端口上的应用程序。我们希望用户使用SSL。 所以我们使用IIS 8作为反向代理来代理从端口443到端口8080的连接。 这就是我们试图实现的: https ://app.example.com ==> app.example.com:8080 / AppName / 以下是URL重写规则 <rule name="Tomcat Reverse Proxy" enabled="true" stopProcessing="true"> <match url="(.*)" ignoreCase="false"/> <action type="Rewrite" url="http://localhost:8080/AppName/{R:1}" logRewrittenUrl="true" /> </rule> 当执行这个规则而不是代理请求时,IIS做了一个redirect,我在浏览器的地址栏中看到http:// localhost:8080 / AppName / 。 问题是AppName 。 IIS URL重写模块不喜欢操作中的大写字母。 但是,Tomcat 7是URL区分大小写的,如果我在重写规则中使用“appname”,Tomcat会抛出一个404。 有没有什么办法可以让IIS在重写中使用大写的url?
我有一个Apache实例和两个Tomcat实例。 Apache公开面对https:// public_url / app1和https:// public_url / app2,并且应该将每个上下文传递给相应的Tomcat实例。 其中一个Tomcat实例没有上下文,即https:// ip_address:port ,我无法使用AJP13或HTTP / S正确代理stream量。 <Location /app1> ProxyPass ajp://127.0.0.1:8009/app1 nocanon ProxyPassReverse ajp://127.0.0.1:8009/app1 </Location> <Location /app2> ProxyPass ajp://127.0.0.2:8009/ nocanon ProxyPassReverse ajp://127.0.0.2:8009/ </Location> 在上面的例子中,app1可以工作,但是app2并没有放弃app2的公共上下文,也就是直接访问后端会得到https:// url / login / login ,所以我想它应该显示为https:// public_url / app2 /login/login,而不是在https:// public_url /login/login 404 我试图用mod_jkreplace上面的app2规则,它支持更复杂的场景,但没有更好的成功。 worker.list=app2_ajp worker.app2_ajp.port=8009 worker.app2_ajp.host=127.0.0.2 worker.app2_ajp.type=ajp13 LoadModule jk_module modules/mod_jk.so JKWorkersFile /etc/httpd/conf.d/workers.properties JkLogFile /var/log/httpd/mod_jk_log […]
我正在尝试使用ProxyPassfunction使用nginx运行node.js应用程序; 我的node.js应用程序在localhost:8888执行,这是我的nginxconfiguration文件 server { listen 80; ## listen for ipv4; this line is default and implied server_name mywebsiteexample.com:80; location / { proxy_pass http://localhost:8888/; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } } 然后当我去我的网页(www.mywebsiteexample.com); 服务器响应好,但没有find相关的文件(CSS,图像等)。
我做了以下步骤: 将所有的needefunction安装到IIS(URLRewrite 2.0,ARR,…) 在VisualStudio中创build默认的MVC Web应用程序 添加这个网站应用程序作为iis的新网站(我可以通过http://localhost访问它) 为这个网站打开了URLRewrite 点击Add Rule(s)… selectReverse Proxy inputgoogle.com作为服务器,HTTP请求将被发送 未选中Enable SSL Offloading 点击OK 当我访问http://localhost我仍然拥有自己的webapp,而不是google.com 。 在我的web.config有: <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{CACHE_URL}" pattern="^(https?)://" /> </conditions> <action type="Rewrite" url="{C:1}://google.com/{R:1}" /> </rule> </rules> </rewrite> 然后,我尝试添加更有用的规则:将localhost/google/sth重写为google.com/search?q=sth 。 我改变了web.config : <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="^google/(.*)" /> <conditions> <add input="{CACHE_URL}" […]
我使用Nginx来负载均衡在多个Node.js实例中运行的websocket应用程序。 当有成千上万的活动连接时,单个消息广播可以使节点在几秒钟内旋转。 在此期间,Node不会处理传入的连接。 即使在服务器负载很重的情况下,为了保持响应的外观,我希望有一个备用的进程,只有在别人没有足够快的响应时才能使用。 我认为将一个Node实例标记为“备份”将起作用: upstream nodejs_backends { least_conn; server 127.0.0.1:5001; server 127.0.0.1:5002; server 127.0.0.1:5003; server 127.0.0.1:5004; server 127.0.0.1:5005; server 127.0.0.1:5006; server 127.0.0.1:5007; server 127.0.0.1:5008 backup; } 备份实例很less接收请求。 看起来像Nginx正在一个一个的通过上游服务器。 备份服务器只有在所有其他服务器都尝试过的情况下才能到达。 由于使用的是least_conn,所以它们会比第一个更加蜂拥而至。 Nginx应该放弃最初尝试并使用备份服务器。 但我不知道如何使它在我使用的Nginx(1.4)版本中发生。 任何帮助或build议,将不胜感激。
我有一个主机(IIS6,通过一个名为Micronovae的Windows运行mod_rewrite的实现,运行良好),它有一个http://some.host.com网站 我还有另一台主机(位于微软Azure),在https://secure.otherhost.com有一个站点 目前我有一个mod_rewrite规则集,因此: #visitor to some.host.com is transparently proxied to new site at secure.otherhost.com ReWriteCond %{HTTP_HOST} some\.host\.com [NC] ReWriteRule (.*) https://secure.otherhost.com$1 [P,L,QSA] 我知道规则的工作原理(虽然我设置了日志logging选项,但是事情似乎没有logging到它应该在的地方),因为如果我将它作为[R]规则而不是[P]规则,那么浏览器会收到redirect并转到HTTPS secure.otherhost.com就好了 但是..如果我启用[P] roxy模式,而我尝试去http://some.host.com只是得到一个404错误 任何人都可以给我一个线索? 服务器可以与外部服务器进行HTTPS对话,然后通过HTTP将结果返回给我的客户端浏览器?
这是我的整个nginx.conf文件 worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { server_name subsonic.domain.com; location / { proxy_pass http://localhost:4040/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass_request_headers on; } } # server { # server_name perforce.domain.com; # location / { # proxy_pass http://localhost:1666/; # proxy_set_header Host $host; # […]