页面直接访问页面:http://192.168.75.101:8983/solr/
就可以在页面中操作各数据,安全性不好,因此希望给solr添加一个密码。
1. 修改web.xml
solr-5.5.3/server/solr-webapp/webapp/WEB-INF/web.xml中添加如下内容
<security-constraint>
<web-resource-collection>
<web-resource-name>Solr Lockdown</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>solr_admin</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr Admin</realm-name>
</login-config>
2. 修改jetty.xml
solr-5.5.3/server/etc/jetty.xml中,</Configure>前添加如下内容
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Solr Admin</Set>
<Set name="config"><SystemProperty name=&