Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 170

Añadido por jredrejo hace casi 14 años

Cambiada la configuración de apache para que controlies funcione como un alias de directorio en lugar de como un virtualhost

Ver diferencias:

controlies/branches/web2py/controlies-apache
WSGIRestrictStdout Off
<VirtualHost *:80>
ServerName ldap
WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py
WSGIDaemonProcess web2py user=www-data group=www-data \
home=/var processes=5 \
maximum-requests=10000
WSGIDaemonProcess web2py user=www-data group=www-data
WSGIProcessGroup web2py
WSGIScriptAlias / /var/web2py/wsgihandler.py
<Directory /var/web2py>
AllowOverride None
Order Allow,Deny
Deny from all
<Files wsgihandler.py>
Allow from all
</Files>
</Directory>
AliasMatch ^/controlies/([^/]+)/static/(.*) \
/var/web2py/applications/$1/static/$2
<Directory /var/web2py/applications/*/static/>
Order Allow,Deny
Allow from all
</Directory>
<LocationMatch ^/controlies/([^/]+)/appadmin>
Deny from all
</LocationMatch>
CustomLog /var/log/apache2/controlies-access.log common
ErrorLog /var/log/apache2/controlies-error.log
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName ldap
WSGIScriptAlias / /var/web2py/wsgihandler.py
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<Directory /var/web2py>
AllowOverride None
Order Allow,Deny
Deny from all
<Files wsgihandler.py>
Allow from all
</Files>
</Directory>
AliasMatch ^/controlies/([^/]+)/static/(.*) \
/var/web2py/applications/$1/static/$2
<Directory /var/web2py/applications/*/static/>
Order Allow,Deny
Allow from all
</Directory>
CustomLog /var/log/apache2/secure-controlies-access.log common
ErrorLog /var/log/apache2/secure-controlies-error.log
</VirtualHost>
</IfModule>
<Location "/controlies">
Order deny,allow
Allow from all
WSGIProcessGroup web2py
</Location>
controlies/branches/web2py/debian/postrm
#!/bin/sh
# postinst script for controlies
#
# see: dh_installdeb(1)
set -e
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
a2dissite controlies-apache
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
controlies/branches/web2py/debian/links
var/web2py/applications/controlies var/web2py/applications/init
controlies/branches/web2py/debian/dirs
var/web2py
etc/apache2/sites-available
etc/apache2/conf.d
etc/ldap/ssl
controlies/branches/web2py/debian/postinst
chown -R www-data:www-data /var/web2py
a2enmod ssl
a2enmod wsgi
a2ensite controlies-apache
a2ensite default-ssl
;;
controlies/branches/web2py/debian/install
applications var/web2py
controlies-apache etc/apache2/sites-available
wsgihandler.py var/web2py
subwsgihandler.py var/web2py
VERSION var/web2py
controlies-apache etc/apache2/conf.d
applications/__init__.py var/web2py
controlies/branches/web2py/debian/changelog
controlies (0.2-2) unstable; urgency=low
* Cambios en la configuración de apache: directorio en vez de vhost
-- José L. Redrejo Rodríguez <jredrejo@debian.org> Mon, 16 May 2011 14:23:55 +0200
controlies (0.2-1) unstable; urgency=low
* Completando funcionalidades
controlies/branches/web2py/subwsgihandler.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Fred Gansevles <fred@gansevles.net>
#
# subwsgihandler.py -- a *hack* to make web2py sub-url mountable
#
# example apache config
#
# WSGIScriptAlias /web2py /usr/local/www/wsgi-scripts/web2py/subwsgihandler.py
# WSGIDaemonProcess subweb2py user=www-data group=www-data \
# home=/usr/local/www/wsgi-scripts processes=5 \
# maximum-requests=10000
#
# <Location "/web2py">
# Order deny,allow
# Allow from all
# WSGIProcessGroup subweb2py
# </Location>
#
# the web2p app is now mounted at http://localhost/web2py
#
import sys
sys.path.insert(0, '')
class SubWeb2py(object):
def __init__(self, application):
self.application = application
import gluon.html
self.gluon_html_URL = gluon.html.URL
gluon.html.URL = self.URL
def URL(self, *args, **kw):
# rewrite the generated URLs, so external referencens have the SCRIPT_NAME prefix
return self.script_name + self.gluon_html_URL(*args, **kw)
def start_response(self, status, headers, info=None):
# rewrite redirect URLs, so external referencens have the SCRIPT_NAME prefix
if not status.startswith('3'):
return self._start_response(status, headers, info)
# status: 3xx (redirect)
_headers = []
for key, value in headers:
if key == 'Set-Cookie':
# don't modify the cookie, it already has a modified location
return self._start_response(status, headers, info)
# relative URLs start with '/', absolute URLs start with 'http'
if key == 'Location' and value.startswith('/'):
value = self.script_name + value
_headers.append((key, value))
return self._start_response(status, _headers, info)
def __call__(self, environ, start_response):
self.script_name = environ['SCRIPT_NAME']
environ['SCRIPT_NAME'] = ''
if self.script_name and environ['REQUEST_URI'].startswith(self.script_name):
environ['REQUEST_URI'] = environ['REQUEST_URI'][len(self.script_name):]
self._start_response = start_response
return self.application(environ, self.start_response)
from web2py.wsgihandler import application
application = SubWeb2py(application)

Exportar a: Unified diff