我正在尝试在nginx代理后面运行solr,而我的nginx配置看起来是这样的(大部分来自here的代码):
upstream my_solr_server {
server 127.0.0.1:8983;
}
server {
listen 80;
listen [::]:80;
# Make site accessible from http://localhost/
server_name search.mysite.com;
client_max_body_size 10G;
large_client_header_buffers 32 128k;
# Some Default NGINX installs have "Welcome to NGINX" at the / location
# This disables that
location / {
return 404;
}
# Create a location block for each handler you'd like to whitelist
location /solr/mycollection/select {
# Only allow GET requests
limit_except GET {
deny all;
}
# prevents 502 bad gateway error
proxy_buffers 32 128k;
proxy_buffer_size 128k;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 400;
proxy_connect_timeout 400;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://my_solr_server;
break;
}
}
}
..它工作正常。但是,当我尝试(查看管理页面)时: http://search.mysite.com/solr/
我一直得到404 ... - 即使我发表了location /
指令
我不确定为什么会发生这种情况。
关于如何解决这个问题的任何建议都会非常有用!