一、配置限制ip訪問web
打開 tomcat裏conf文件下的server.xmlapache
在<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">下添加代碼tomcat
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="10.61.*.*||10.66.*.*" deny=""/>服務器
「||「是或者的意思app
「*」爲整個ip段webapp
二、設置圖片服務器server
打開server.xmlxml
在<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">下添加代碼圖片
<Context docBase="D:\GoodsImgs" path="/GoodsImgs" reloadable="true"/>ip
使用方法
$("#img").attr("src","http://你的ip:8080/GoodsImgs/"+data[1].img);