使用 8081 端口将 Apache 代理到 Geoserver 8080 以实现 WFS
我已经陷入困境好几天了,现在我非常感谢你的帮助。 这是我的情况: - Ubuntu Linux(所有端口均已打开) - Apache 在端口 8081 上运行 - 端口 8080 上的 Geoserver Tomcat 我正在尝试通过与服务器不同的电脑建立 WFS 连接,因此我需要使用代理。 在我的服务器中,我编辑了 httpd.conf 并添加了这些行:
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver http://mydomain.com:8080/geoserver
ProxyPassReverse /geoserver http://mydomain.com:8080/geoserver
我从 OpenLayers 下载了 proxy.cgi 并进行了编辑以添加我允许的主机(localhost:8081、localhost、mydomain:8081 等) 当我在网络浏览器中打开 proxy.cgi 时,我被转发到 openlayers 站点,因此我认为 python 和脚本运行正常。 然后我将 http://mydomain.com:8081/geoserver 添加到 geoserver 仪表板中的基本代理 URL。 在我的 html 中,我将每个脚本文件(如 Openlayers.js、GeoExt、js)指向 apache,端口为 8081。 在我的 init 函数中,我输入:
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
带有 WFS 的矢量图层如下所示:
var inc2007 = new OpenLayers.Layer.Vector("Inc", {
styleMap: styles1,
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://mydomain.com:8081/geoserver/wfs",
featurePrexif: "Inc",
featureType: "Inc",
featureNS: "http://mydomain.com:8080/Incendi"
}),
});
我在地图上看不到该层,并且 firebug 不会记录任何内容。 我尝试将 ProxyHost 链接更改为“http://mydomain.com:8081/cgi-bin/proxy.cgi?url=”,但没有任何结果。 我能做些什么? 我真的……真的需要你的帮助。
预先感谢您的回复
I've been in a dilemma for several days and now I'd really appreciate your help.
Here is my situation:
- Ubuntu Linux (All ports opened)
- Apache running on port 8081
- Geoserver Tomcat on port 8080
I'm trying to make a WFS connection by a different pc than the server so I need to use a proxy.
In my server I edited httpd.conf and added these lines:
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver http://mydomain.com:8080/geoserver
ProxyPassReverse /geoserver http://mydomain.com:8080/geoserver
I downloaded proxy.cgi from OpenLayers and edited to add my allowed hosts (localhost:8081, localhost, mydomain:8081, etc.)
When I open proxy.cgi in the web browser I'm forwarded to the openlayers site, so I think that python and the script are running correctly.
Then I added http://mydomain.com:8081/geoserver to the base proxy URL in geoserver dashboard.
In my html I point every script file like Openlayers.js, GeoExt,js to apache so with port 8081.
Inside my init function I put:
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
and the vector layer with WFS is like this:
var inc2007 = new OpenLayers.Layer.Vector("Inc", {
styleMap: styles1,
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://mydomain.com:8081/geoserver/wfs",
featurePrexif: "Inc",
featureType: "Inc",
featureNS: "http://mydomain.com:8080/Incendi"
}),
});
I can't see this layer on the map and firebug doesn't log anything.
I tried to change the ProxyHost link to "http://mydomain.com:8081/cgi-bin/proxy.cgi?url=" but nothing.
What can I do?
I really...really need your help.
Thanks in advance for your replies
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保所有 openlayers WFS 协议属性与其相应的 GeoServer 属性正确匹配。
十分之九,这就是 WFS 层不显示的原因。
看看我的答案 这里和此处。
Make sure all the openlayers WFS protocol properties match up correctly to their corresponding GeoServer properties.
nine times out of ten, this is why the WFS layer does not show up.
Take a look at my answers here and here.
通过将 proxy.cgi 放在本地 apache 上而不是放在驻留在 geoserver 机器上的 apache 上来解决...
Solved by putting proxy.cgi on the local apache and not on the apache residing on the geoserver machine...