Hi,

I have had some success using wsgi on a fedora system by installing
the following config file in /etc/httpd/conf.d . It's basically the
config from the online manual with rewrite rules taken from the user
group.

I have two applications, 'cpa4' and 'master' that are accessed with
http://server2/w2p/cpa4 and http://server/w2p/master.
----------------------------------------------------------------------
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
  ServerName server2
  RewriteEngine on
  RewriteLog "/var/log/httpd/rewrite_log"
  RewriteLogLevel 9
  RewriteRule ^/master(.*)$ /w2p/master$1 [PT,L]
  RewriteRule ^/cpa4(.*)$ /w2p/cpa4$1 [PT,L]
  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py user=apache group=apache home=/opt/web-apps/
web2py
  WSGIProcessGroup web2py

  <Directory /opt/web-apps/web2py>
        AllowOverride None
        Order Allow,Deny
        Deny from all
        <Files wsgihandler.py>
          Allow from all
        </Files>
  </Directory>

  AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/
$1/static/$2

  <Directory /opt/web-apps/web2py/applications/*/static>
        Options -Indexes
        Order Allow,Deny
        Allow from all
  </Directory>

  <Location /admin>
        Deny from all
  </Location>

  <LocationMatch ^/([^/]+)/appadmin>
        Deny from all
  </LocationMatch>

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log
</VirtualHost>

<VirtualHost *:443>
  ServerName server2
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  RewriteEngine on
  RewriteLog "/var/log/httpd/rewrite_log"
  RewriteLogLevel 9
  RewriteRule ^/admin(.*)$ /w2p/admin$1 [PT,L]
  RewriteRule ^/examples(.*)$ /w2p/examples$1 [PT,L]

  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py2 user=apache group=apache home=/opt/web-
apps/web2py
  WSGIProcessGroup web2py2

  <Directory /opt/web-apps/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

  AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/
$1/static/$2

  <Directory /opt/web-apps/web2py/applications/*/static>
    Options -Indexes
    ExpiresActive On
    ExpiresDefault "access plus 1 hour"
    Order Allow,Deny
    Allow from all
  </Directory>

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log
</VirtualHost>
----------------------------------------------------------------------


On Feb 8, 12:52 pm, giovanni allegri <gioha...@gmail.com> wrote:
> For now I've solved setting the WSGIScriptAlias to /w2p
>
> and in routes.py:
>
> > routes_out = ((r'/(?P<any>.*)', r'/w2p/\g<any>'),)
>
> Any comments are welcome for something cleaner, but I fear that
> "reverse rewriting" for URL() is only possible if set inside
> routes.py. Am I wrong?
>
> giovanni
>
> On 8 Feb, 18:45, giovanni allegri <gioha...@gmail.com> wrote:
>
> > I've seen a lot of examples to manage url rewriting and proxying with
> > web2py, but I haven't found a solution to my problem.
> > I don't have much experience with mod_rewrite, but I would like to use
> > it and avoid rewriting inside web2py (through its routes facilites).
>
> > My situation is a single domain, where various applications are hosted
> > through Aliases.
> > I have path_to_wsgi/applications/myapp, and I would like to serve it
> > athttp://my.domain.ip/myapp.
> > The domain root points to another service, so I can't install web2py
> > to the root.
> > Is there e ready to use recipe to do it?
>
> > Thanks
> > giovanni
>
>

Reply via email to