#1 Tue 11 March 2014 01:45
- yassine10
- Juste Inscrit !
- Date d'inscription: 28 Feb 2014
- Messages: 6
Configurer geoserver avec apache en utilisant le proxy
j'ai déjà visualisé mes couches sur "la prévisualisation descouches" sur geoserver et je veux les afficher dans un serveur web..j'ai installé apache 2.4 et j'ai cherché dans les forums et j'ai trouvé que je dois créer un fichier proxy et le mettre dans le dossier d'installation d'Apache ainsi qu'une certaine configuration dans le fichier httpd existant dans Apach/config...est ce que quelqu'un peux m'expliquer toute la procédure à suivre pour connecter l'Apache avec Geoserver. je suis bloqué depuis 2 semaines et je ne sais pas comment faire
Merciii beaucoup
Hors ligne
#2 Wed 12 March 2014 16:22
- abdoudiouck
- Participant occasionnel
- Lieu: RENNES
- Date d'inscription: 19 Aug 2010
- Messages: 17
Re: Configurer geoserver avec apache en utilisant le proxy
Il faut créer un lien symbolique pour rediriger le localhost:8080 de geoserver vers le localhost:80
il faudra que tu rajoutes ceci dans ton conf d'apache
Code:
########################################################
## Configuration du proxypass Apache Tomcat de Geoserver
#######################################################
ProxyRequests Off
ProxyPreserveHost On
<Proxy * >
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver http://localhost:8080/geoserver
ProxyPassReverse /geoserver http://localhost:8080/geoserver
ProxyPass /geoserver/ ajp://localhost:8080/geoserver/
ProxyPassReverse /geoserver/ ajp://localhost:8080/geoserver/
<VirtualHost *:80>
ProxyPass /geoserver http://localhost:8080/geoserver
ProxyPassReverse /geoserver http://localhost:8080/geoserver
</VirtualHost>et si tu tappes localhost/geoserver t est redirigé automatiquement
Pour le proxy il faut que tu adaptes le proxy d'openlayers disponible sur http://trac.osgeo.org/openlayers/wiki/F … OpenLayers
Puis le mettre dans ton cgi-bin
Dernière modification par abdoudiouck (Wed 12 March 2014 16:23)
Hors ligne
#3 Wed 12 March 2014 16:31
- yassine10
- Juste Inscrit !
- Date d'inscription: 28 Feb 2014
- Messages: 6
Re: Configurer geoserver avec apache en utilisant le proxy
mercii beaucoup !! mais comment je dois adapter mon fichier du proxy ? je suis un débutant dans geoserver et apache ![]()
Hors ligne
#4 Fri 14 March 2014 16:51
- abdoudiouck
- Participant occasionnel
- Lieu: RENNES
- Date d'inscription: 19 Aug 2010
- Messages: 17
Re: Configurer geoserver avec apache en utilisant le proxy
Il te faut un python et tu modifis ce chemin
Code:
#!C:/Win32app/Python/python.exe -u
et tu rajoutes tes servers d'acces au niveau de allowedHosts
sinon
voici un exemple
Code:
#!C:/Win32app/Python/python.exe -u
"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript. This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it. It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""
import urllib2
import cgi
import sys, os
# Designed to prevent Open Proxy type stuff.
allowedHosts = ['www.openlayers.org', 'openlayers.org',
'labs.metacarta.com', 'world.freemap.in',
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.avencia.com','kartenn.region-bretagne.fr',
'localhost' , 'localhost:8080' ]
method = os.environ["REQUEST_METHOD"]
if method == "POST":
qs = os.environ["QUERY_STRING"]
d = cgi.parse_qs(qs)
if d.has_key("url"):
url = d["url"][0]
else:
url = "http://www.openlayers.org"
else:
fs = cgi.FieldStorage()
url = fs.getvalue('url', "http://www.openlayers.org")
try:
host = url.split("/")[2]
if allowedHosts and not host in allowedHosts:
print "Status: 502 Bad Gateway"
print "Content-Type: text/plain"
print
print "This proxy does not allow you to access that location (%s)." % (host,)
print
print os.environ
elif url.startswith("http://") or url.startswith("https://"):
if method == "POST":
length = int(os.environ["CONTENT_LENGTH"])
headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
body = sys.stdin.read(length)
r = urllib2.Request(url, body, headers)
y = urllib2.urlopen(r)
else:
y = urllib2.urlopen(url)
# print content type header
i = y.info()
if i.has_key("Content-Type"):
print "Content-Type: %s" % (i["Content-Type"])
else:
print "Content-Type: text/plain"
print
print y.read()
y.close()
else:
print "Content-Type: text/plain"
print
print "Illegal request."
except Exception, E:
print "Status: 500 Unexpected Error"
print "Content-Type: text/plain"
print
print "Some unexpected error occurred. Error text was:", EHors ligne


