我正在尝试为广告图片(gif,jpg,swf)服务设置反向缓存代理.代理工作正常并将请求发送到源服务器,但我似乎无法弄清楚为什么内容没有被缓存.我目前的配置如下.目标是缓存与/ ca / URI前缀匹配的所有请求.原始服务器正在为原始服务器标头上设置的干净URL,没有文件扩展名,Cache-control max-age = 1周的文件提供服务.
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<IfModule mod_disk_cache.c>
CacheEnable disk /
CacheRoot "/var/cache/mod_proxy"
CacheDirLevels 3
CacheDirLength 5
CacheIgnoreCacheControl On
</IfModule>
RewriteCond %{REQUEST_URI} ^/ca/*
RewriteRule ^/(.*)$ http://origin.webserver.com/$1 [P,L]
目前,我见过的唯一缓存实际上是在代理服务器上访问的本地文件,我正在寻找我所缺少的内容,以便从原始服务器获取内容以进行缓存.
我想知道是否与mod_cache没有缓存有关,因为内容是从源服务器获取的,而不是磁盘上的位置.寻找一种方法来强制缓存匹配该前缀的所有请求.
谢谢!
ps - 看起来我遇到了这个问题: http://mail-archives.apache.org/mod_mbox/httpd-users/200901.mbox/%3C497F6ED3.7080606@gmail.com%3E.将检查我的权限并检查调试消息...
如何设置nginx将单个文件夹反向代理到一个服务器,将其余的root代理反向代理到另一个服务器?
根"/"由CMS管理,而"其他"是我自己的程序(独立于CMS).
这是我目前的配置
server {
listen 80;
server_name www.example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
... <ssl stuff> ...
server_name www.example.com;
location /other {
proxy_pass http://192.168.2.2/other ;
}
location / {
proxy_pass http://192.168.1.1;
}
}
Run Code Online (Sandbox Code Playgroud) 嗨,我正在努力让以下工作!
我基本上试图通过这两个URL中的任何一个将以下URL传递给proxy_pass指令:
http://example.com/admin/1或http://example.com/admin/2/
我有以下配置:
location /admin/ {
# Access shellinabox via proxy
location 1/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://example.com;
}
}
Run Code Online (Sandbox Code Playgroud)
目前,抛出一个错误:
2016/01/17 15:02:19 [emerg] 1#1: location "1/" is outside location "/admin/" in /etc/nginx/conf.d/XXX.conf:37
nginx: [emerg] location "1/" is outside location "/admin/" in /etc/nginx/conf.d/XXX.conf:37
Run Code Online (Sandbox Code Playgroud) 我有一个 Web 服务,它位于这样的反向代理后面:

现在发生的情况是,当我尝试添加 Web 引用来测试 Web 服务时,它说无法下载 wsdl 文件。那是因为当请求被发送时它是https://uat.mywebservice.com/Service/Service.asmx但是当它击中反向代理然后厌倦下载 wsdl 和迪斯科文件时,它会将链接更改为http: //myservice.comp.com/Service/Service.asmx?wsdl这不是正确的链接,因为myservice.comp.com它只是反向代理上的名称空间。
发生的事情是soap文件中的标题被更新到这个命名空间而不是实际的主机名uat.mywebservice.com,我能够看到使用fiddler disco文件的地址不正确。我通过使用 wsdl.exe 工具创建一个代理类,然后将该类中的所有错误链接更新为正确的主机名。
有什么方法可以确保在点击反向代理时地址保持正确。
不正确: mywebservice.comp.com
<?xml version="1.0" encoding="utf-8" ?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://mvwebservice.comp.com/Service/Service.asmx?wsdl" docRef="http://mvwebservice.comp.com/Service/Service.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://mywebservice.comp.com/Service/Service.asmx" xmlns:q1="http://tempuri.org/" binding="q1:ServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://mywebservice.comp.com/Service/Service.asmx" xmlns:q2="http://tempuri.org/" binding="q2:ServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
Run Code Online (Sandbox Code Playgroud)
正确的: uat.mywebservice.com
<?xml version="1.0" encoding="utf-8" ?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="https://uat.mvwebservice.com/Service/Service.asmx?wsdl" docRef="https://uat.mvwebservice.com/Service/Service.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="https://uat.mywebservice.com/Service/Service.asmx" xmlns:q1="http://tempuri.org/" binding="q1:ServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="https://uat.mywebservice.com/Service/Service.asmx" xmlns:q2="http://tempuri.org/" binding="q2:ServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" …Run Code Online (Sandbox Code Playgroud) 我有一个在heroku上运行的rails应用程序,例如myapp.herokuapp.com.
现在,我想从反向代理myapp.heroku.com/proxy/到somewhereelse.com/(即:myapp.heroku.com/proxy/stuff反向proxifed到somewhereelse.com/stuff)是可能在Heroku?怎么做到这一点?
我有一个 jenkins 构建器服务器,我正在尝试使用 nginx 设置反向代理。我遵循了 jenkins 站点上的所有操作方法和文档,但唯一不同的是我需要可以在不同端口上访问服务器,然后是标准 https 端口。
必须可以访问https://jenkins.example.com:9090现在正在运行的服务器,但我仍然遇到一些问题。在管理詹金斯我不断收到消息
您的反向代理设置似乎已损坏
此外,当我登录或应用或保存一些配置更改时,我不断被重定向到https://jenkins.example.com没有端口号。
当我检查 curl 并查看某些页面的标题时,它会不断将位置标题设置为正确的 url 但没有端口号。
我在nginx中有以下配置
server {
listen 443 ssl spdy;
server_name jenkins.example.com;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header X-Frame-Options "DENY";
ssl on;
ssl_certificate /etc/nginx/ssl/server.chain.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-$
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# enable ocsp stapling (mechanism by which a site can convey certificate revocation information to …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Nginx 作为我在 github 页面上的页面的反向代理。根据此处的信息:https : //pascal.io/github-pages-https/和其他人,我的配置如下所示:
server {
listen 80 default_server;
server_name leepope.com www.leepope.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name leepope.com;
ssl on;
ssl_certificate <my cert>;
ssl_certificate_key <my key>;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL:10m;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=15768000;
location / {
proxy_pass https://leepope.github.io;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_intercept_errors on;
expires off;
}
}
Run Code Online (Sandbox Code Playgroud)
当我向服务器根目录发出请求时,我得到了一个 github 页面,但它是 404。
我已经启用了 nginx 调试,但是我看不到发送到 github …
问题:Nginx 和 Netty 用于构建代理服务器的优缺点是什么?
细化问题:
我们正在尝试实现一个代理服务器(正向或反向代理),它位于服务前面,并负责可应用于我们服务的良好实践。
因此,我们正在评估市场上可用的不同解决方案,主要是 Nginx 和 Netty。因此,当我们最初对 Nginx 进行研究时,我们遇到了大量正面的博客,这些博客表明 Nginx 非常快,通过编写自定义模块到 Nginx 插件可以轻松配置。
但是当我们在 Netty 上做 POC 时,我们在使用 Netty 4 时得到了更好的性能数据。 所以我想知道是否有人对 Nginx 和 Netty 进行了一些比较,以及不使用 Netty 作为反向的原因是什么/转发代理解决方案。我们担心与 Java Server 解决方案相关的 GC 问题,因此我们想在继续解决方案之前了解 Nginx 和 Netty 的优缺点。
谢谢,维奈。
我有 5 个后端服务器。我希望 nginx 将 /myapp/refresh 的 POST 请求转发到所有 5 个后端服务器。对于任何其他请求,它可以做负载平衡。这可能吗 ?你能给出一个示例配置吗?
我想在操作请求和响应 URI 的同时使用入口和出口的(反向)代理转发流量。
场景是这样的:
来自互联网的入口 请求(请求 uri 为“/test/”)进入端口 8888 上的 ec2 实例,然后进入侦听此端口的 Nginx docker 容器,并在“替换”时代理将其传递到第二个 docker 容器请求 uri 为端口 12345 上的“/”(然后在容器内将其转发到端口 8787 到 Web 应用程序)。
出口 从第二个 docker 容器返回到 Nginx 容器的响应必须再次“重建”到原始 uri(“/test/”),并作为响应发送回原始客户端。
我想我通过像这样配置 Nginx 来获得入口部分:
server {
listen 8888;
server_name 172.17.0.1;
location / {
proxy_pass "http://172.17.0.1:12345";
}
}
Run Code Online (Sandbox Code Playgroud)
但它似乎不太正确,因为我认为它应该使用 Nginx 本身(172.17.0.3)作为“server_name”并使用 Web 应用程序(172.17.0.2)作为上游,但这不起作用(502 错误)。
reverse-proxy ×10
nginx ×7
apache2 ×1
asmx ×1
asp.net ×1
build-server ×1
c# ×1
caching ×1
containers ×1
curl ×1
docker ×1
github-pages ×1
heroku ×1
jenkins ×1
location ×1
netty ×1
performance ×1
proxy ×1
proxypass ×1
web-services ×1