在这里先发布帖子,对不起,如果我没有完全遵守所有规则。
因此,我需要一些帮助/建议,以使用NGINX反向代理+缓存配置Jira服务器。
我的配置的反向代理部分可以正常工作,但是由于某些原因,当我使用nginx proxy_cache模块时,会发生奇怪的事情。
当缓存处于活动状态时,我无法使用#帮助台易于记忆的URL 部分中定义的URL。
我在Chrome和Firefox中收到重定向过多错误。 当我深入研究时,绝对可以在Chrome开发工具中看到重定向循环。
这是我的配置:
# ssl certs definition
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
# proxy-cache config
proxy_cache_path /var/run/nginx-cache levels=1:2 keys_zone=nginx-cache:10m max_size=500m;
proxy_temp_path /var/run/nginx-cache/tmp;
# default redirect all http traffic to https
server {
listen 80;
server_name *.xxx.com;
return 301 https://$host$request_uri;
}
# helpdesk easy to remember url
server {
listen 443 ssl;
server_name help.xxx.com;
ssl on;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
return 302 https://aaa.xxx.com/plugins/servlet/desk/;
}
}
# jira server block
server {
listen 443 ssl;
server_name aaa.xxx.com;
ssl on;
location / {
proxy_pass http://jira-server.local:8080;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
client_max_body_size 300M;
proxy_cache nginx-cache;
proxy_cache_valid 1440m;
proxy_cache_min_uses 1;
add_header X-Proxy-Cache $upstream_cache_status;
set $do_not_cache 0;
if ($request_uri ~* ^(/plugins|/secure/project|/secure/admin)) {
set $do_not_cache 1;
}
proxy_cache nginx-cache;
proxy_cache_valid 1440m;
proxy_cache_min_uses 1;
proxy_cache_bypass $do_not_cache;
add_header X-Proxy-Cache $upstream_cache_status;
}
location ~*/(feed)$ {
proxy_pass http://jira-server.local:8080;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
client_max_body_size 300M;
proxy_cache nginx-cache;
proxy_cache_valid 1440m;
proxy_cache_min_uses 1;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers Cache-Control;
}
}
我在这里找到了proxy_cache和Jira的一些配置:https://community.atlassian.com/t5/Jira-questions/Jira-behind-nginx-proxy-cache/qaq-p/138449
在这里:https://blog.servicerocket.com/adoption/blog/2015/04/setting-up-nginx-as-a-proxy-cache-for-jira
谢谢。