Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Configuration 如何配置jetty以允许从外部服务器访问?_Configuration_Solr_Jetty - Fatal编程技术网

Configuration 如何配置jetty以允许从外部服务器访问?

Configuration 如何配置jetty以允许从外部服务器访问?,configuration,solr,jetty,Configuration,Solr,Jetty,我以前见过这样的问题,但没有很好的答案,如何配置jetty以允许从外部服务器访问?我刚刚开始玩弄solr和jetty,正在使用solr附带的示例jetty实例 solr在本地主机上运行良好,我可以从同一服务器上的站点查询它。但是,我无法从另一台服务器访问solr实例。在过去的几天里,我在谷歌上搜索和阅读了很多内容,但没有发现是什么阻止jetty允许非本地主机访问solr 根据我所读的内容,我尝试在example/etc/jetty.xml中添加以下行 <Set name="Host">

我以前见过这样的问题,但没有很好的答案,如何配置jetty以允许从外部服务器访问?我刚刚开始玩弄solr和jetty,正在使用solr附带的示例jetty实例

solr在本地主机上运行良好,我可以从同一服务器上的站点查询它。但是,我无法从另一台服务器访问solr实例。在过去的几天里,我在谷歌上搜索和阅读了很多内容,但没有发现是什么阻止jetty允许非本地主机访问solr

根据我所读的内容,我尝试在example/etc/jetty.xml中添加以下行

<Set name="Host">0.0.0.0</Set> 
当我开始的时候

我使用的start命令是

sudo java -jar start.jar etc/jetty.xml

你可以指给我看,或者用勺子喂我,我不在乎。我只想克服这一障碍,以便继续学习如何设置和使用solr。

您应该添加一个名为clientaccesspolicy.xml的文件,以便跨域访问静态web文件目录:

<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-methods="*" http-request-headers="*">
        <domain uri="http://*"/>
        <domain uri="https://*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
java.net.BindException: Cannot assign requested address
sudo java -jar start.jar etc/jetty.xml
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-methods="*" http-request-headers="*">
        <domain uri="http://*"/>
        <domain uri="https://*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
ResourceHandler staticHandler = new ResourceHandler();
staticHandler.setResourceBase("static/dir");
handlers.addHandler(staticHandler);