Articles of proxypass

NGINX – 通过S3提供静态文件或故障恢复到本地服务器

我将nginx作为一个负载均衡器(使用caching),并将请求传递给一些AWS EC2实例来服务这些页面。 当谈到服务静态资源,我想通过AWS S3(这是工作正常)尝试和服务,但如果该文件返回403/404等,我想请求继续通过一个EC2实例送达。 我现在有这个: location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { try_files $uri @s3; } 它寻找静态文件,然后通过S3服务,这是好的…但如何修改这个或我的@ s3的位置回落到请求的正常proxy_pass如果文件没有退出S3? 谢谢

Nginx的proxy_path根重写到域/path

这在proxy_pass上可能是这样的吗? location / { proxy_pass http://example.com/path/; } 要求将所有来自http://example.com的请求指向http://another-example.com/path

Nginx反向代理与GitLab作为Oauth2提供商和NextCloud

我想要做的总结如下。 我有一个NGinx服务器,承载了三种不同的东西:GitLab,NextCloud和一个专有服务。 GitLab充当Oauth供应商,用户必须通过authentication才能访问我们托pipe的任何网站。 因此,我在Nginx中使用了一个反向代理。 我成功地能够authentication并访问我们的GitLab和我们专有的软件。 但NextCloud和Oauth不想一起工作。 我还应该提到,现在我们正在混淆我们服务的url。 例如,我正在尝试在https://oursite.com/test-test/提供NextCloud,但是当您第一次访问该网站时,您应该将其redirect到GitLab,然后再跳回到NextCloud。 我还应该提到,我正在使用oauth处理程序侦听端口4180和4181的oauth2_proxy应用程序。 这里是使用的configuration: Base Nginxconfiguration server { listen 80; server_name oursite.com; client_max_body_size 10m; location /api/ { proxy_pass http://127.0.0.1:4180/api/; proxy_set_header Host $host; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Port 443; } location /obfuscated-url-1/ { proxy_pass http://127.0.0.1:4180; proxy_set_header Host $host; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Port 443; […]

Nginx转发请求到URL

我试图转发一个http请求到服务器在请求的url中指定,但我总是得到一个404结果。 这是我的configuration: worker_processes 2; daemon off; error_log /var/log/nginx.error_log info; events { worker_connections 1000; # use [ kqueue | epoll | /dev/poll | select | poll ]; use epoll; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" ' '"$gzip_ratio"'; log_format download '$remote_addr – $remote_user […]

Apache ProxyPass可以在后端连接失败时重试请求

我使用Apache作为反向代理到应用服务器层 – 使用ProxyPass。 App Server是单个实例(无负载平衡)。 定期(可能是由于一些较低级别的networking问题)Apachelogging以下错误。 [Mon Jul 10 12:48:43.491680 2017] [proxy_http:error] [pid 17325:tid 139862111938304] [client xxxx:21241] AH01114: HTTP: failed to make connection to backend: prod_java, referer: https://my.company.com/app/request 并且503服务不可用响应被返回给客户端。 我正在考虑设置以下对连接失败的反应更快: ProxyPass /app http://PROD_JAVA:8080/app connectiontimeout=1 retry=0 keepalive=On 我的问题是 – 在这种失败的情况下,是否有办法让Apache再次将请求重新发送到后端 – 而不是立即回应客户端?

NGINX中的proxy_pass CDN文件,但得到502错误的请求

我正在使用S3来存储xml文件并使用CloudFront来分发此文件。 我想使用nginx的proxy_passfind这个文件,而不用改变我的域名。 如www.mydomain.com/filename.xml该文件的S3 url是: https ://s3-ap-southeast-2.amazonaws.com/bucketname/bucket-sub-name/filename.xml CDNurl是https://dev.example.com/filename.xml如果我写下面的nginxconfiguration,它工作正常。 if($request_uri = "/filename.xml") { rewrite .* /bucketname/bucket-sub-name$request_uri break; proxy_pass https://s3-ap-southeast-2.amazonaws.com; } 但是,如果我改变像下面的nginxconfiguration,它给了我502坏的网关 if($request_uri = "/filename.xml"){ proxy_pass https://dev.example.com$request_uri; } 要么 if($request_uri = "/filename.xml"){ proxy_pass https://s3-ap-southeast-2.amazonaws.com/bucketname/bucket-sub-name$request_uri; } 有没有人可以解释为什么第一个工作和第二个和第三个部分不工作? 那是因为CDNconfiguration有什么问题吗? 那可以直接proxu_pass url吗?

使用Location proxyPass将api调用从子域redirect到主域

我想将我的api调用从子域redirect到主域。 我的API服务器是在example.com。 请求url是http://foo.example.com/api?service=work&action=all_work ,但我的文件系统调用应该通过。 <VirtualHost *:80> ServerName example.com ServerAlias foo.example.com RewriteEngine On <Proxy *> Order Allow,Deny Allow from all </Proxy> <Location /api> ProxyPass http://othersite.com/api retry=0 SetOutputFilter DEFLATE </Location> DocumentRoot /var/www/example RewriteCond %{HTTP_HOST} ^(foo.example.com)$ [NC] RewriteCond %{REQUEST_URI} =/ RewriteRule (.*) /var/www/example/index.html [L] RewriteCond %{HTTP_HOST} ^(foo.example.com)$ [NC] RewriteCond %{REQUEST_URI} !=/ RewriteRule (.*) /var/www/example/$1 [L] </VirtualHost> 但是我正在浏览器上获得404。

对于不同的目标url,Proxypass错误

我已经为subversion的Apache服务器启用proxypass设置。 它的工作正常以下的设置。 也能够检出库。 ProxyPass /svn/testing_migration https://example.com/svn/testing_migration/ ProxyPassReverse /svn/testing_migration https:/example.com/svn/testing_migration/ 当我传递包含不同path的不同服务器时,在检出回购时出现错误。 以下是设置 ProxyPass /svn/testing_migration https://example.com/svn/testing_migration/svn/repos/testing_migration/ ProxyPassReverse /svn/testing_migration https:/example.com/svn/repos/testing_migration/ 上述设置工作正常,当我通过浏览器访问存储库,但在检出回购时出错。 错误:url不一样

Apache ProxyPass到socket.io有加载问题

我有一个服务于PHP网站的networking服务器。 这个服务器有一个socket.io服务器。 Apacheconfiguration为代理通过socket.io请求到端口8000上运行的节点服务器。一切工作正常。 但在过去几天,服务器负载超过100,但CPU,内存和磁盘利用率非常低。 当有良好的stream量时,apache进程数量不断增加,负载也随之增加。 我怀疑,Apache处理不断等待的东西。 stace输出有这样的: read(22, 0x7f024a144048, 8000) = -1 EAGAIN (Resource temporarily unavailable) lsof -p xxxx | grep 22的输出显示了这个: apache2 20687 www-data 22u IPv4 2406045 0t0 TCP PROD2:59319->PROD2:http-alt (ESTABLISHED) Apacheconfiguration: <VirtualHost *:443> ServerAdmin xxxx ServerName xxxx ServerAlias xxxx DocumentRoot /var/www/html SSLEngine on SSLProxyEngine On SSLCertificateFile /etc/xxxx/a32d505bae7b7403.crt SSLCertificateKeyFile /etc/xxxx/xxxx.key SSLCertificateChainFile /etc/xxxx/gd_bundle-g2-g1.crt ErrorLog ${APACHE_LOG_DIR}/error.log […]

nginx重写proxy_passconfiguration不工作

我有一个configurationnginx服务器; server { listen 9090; server_name localhost; root /Users/anonuser/Desktop/workspace/ttttt/portal/design; 其中有一套rewrite和proxy_pass命令; rewrite ^.*(/account/.*)$ $1 last; location /account { proxy_pass https://www.example.com; } rewrite ^.*(/iap-dataapi/.*)$ $1 last; location /iap-dataapi { proxy_pass https://www.example.com; } rewrite ^.*(/era/.*)$ $1 last; location /era/ { proxy_pass https://www.example.com; } rewrite ^.*(/imageScaler/.*)$ $1 last; location /imageScaler/ { proxy_pass https://www.example.com; } 我打电话给位于的应用程序; http://localhost:9090/oba-client/com/tttt/portal/cust/ 有一个index.html文件位于,它有一个线,以一个类似的东西给一个主机的Ajax请求; HTTP://本地主机:9090 / […]