WebFaction
Community site: login faq

Hello,

after reading a lot about creating virtual hosts with apache I've done this in my httpd.conf:

ServerRoot /home/[USER]/webapps/apache/apache2

LoadModule alias_module       modules/mod_alias.so
LoadModule authz_host_module  modules/mod_authz_host.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authz_user_module  modules/mod_authz_user.so
LoadModule authn_file_module  modules/mod_authn_file.so
LoadModule dir_module         modules/mod_dir.so
LoadModule env_module         modules/mod_env.so
LoadModule log_config_module  modules/mod_log_config.so
LoadModule mime_module        modules/mod_mime.so
LoadModule rewrite_module     modules/mod_rewrite.so
LoadModule setenvif_module    modules/mod_setenvif.so
LoadModule wsgi_module        modules/mod_wsgi.so
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/[USER]/logs/user/access_apache.log combined
# fall back to this directory if the directory defined via
# WSGIScriptAlias is not accessible
DocumentRoot /home/[USER]/webapps/apache/htdocs
DirectoryIndex index.py
ErrorLog /home/[USER]/logs/user/error_apache.log
KeepAlive Off
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess apache processes=2 python-home=/home/[USER]/webapps/apache/lib/python2.7 threads=1
WSGIProcessGroup apache
WSGIRestrictEmbedded On
WSGILazyInitialization On

Listen 29644
NameVirtualHost *:29644

<VirtualHost *:29644>
ServerName mutetella.org

Alias / /home/[USER]/webapps/static/index.html
    <Directory /home/[USER]/webapps/static>
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:29644>
ServerName mutetella.org

Alias /htdocs /home/[USER]/webapps/trac/.htdocs
    <Directory /home/[USER]/webapps/trac/.htdocs>
        Order allow,deny
        Allow from all
    </Directory>

WSGIDaemonProcess trac processes=2 threads=15
WSGIScriptAlias /trac /home/[USER]/webapps/trac/.cgi-bin/trac.wsgi
    <Directory /home/[USER]/webapps/trac/.cgi-bin>
        WSGIProcessGroup trac
        WSGIApplicationGroup %{GLOBAL}
        Order allow,deny
        Allow from all
    </Directory>

    <LocationMatch "/[^/]+/login">
        AuthType Digest
        AuthName "trac"
        AuthDigestDomain /
        AuthUserFile /home/[USER]/webapps/trac/.htpasswd
        Require valid-user
    </LocationMatch>

</VirtualHost>

# show ``index.py`` as wsgi script if no other app/script is defined above
# the name ``index.py`` is defined via ``DirectoryIndex`` above
<Directory /home/[USER]/webapps/apache/htdocs>
    AddHandler wsgi-script .py
</Directory>

Invoke 'mutetella.org' will process the /home/[USER]/webapps/static/index.html as expected. But calling 'mutetella.org/trac' causes in a '404 Not Found Error' and the error log says 'File does not exist: /home/[USER]/webapps/static/index.htmltrac'

What am I doing wrong?

EDIT Within my webfaction configuration I've linked 'apache (mod_wsgi 4.2.8/Python 2.7)'' with the domains 'mutetella.org' and 'www.mutetella.org' each on path /.

asked 19 Jan '15, 13:11

mutetella
23258
accept rate: 0%

edited 19 Jan '15, 15:43


I've checked your site, and http://mutetella.org/trac seems to be working correctly for me.

I suspect that you needed to restart your Apache instance to pick up some config changes, and everything started working after that.

permanent link

answered 19 Jan '15, 18:38

seanf
12.2k41836
accept rate: 37%

It works cause I am using a different configuration in the meantime. It seems that combining Alias and WSGIScriptAlias don't work. A first solution for me is to use only Alias like this:

Alias /trac /home/[USER]/webapps/trac/.cgi-bin/trac.wsgi
<Directory /home/[USER]/webapps/trac/.cgi-bin>
    AddHandler wsgi-script .wsgi
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

But this don't makes me happy! I would prefer a solution with WSGIScriptAlias within <VirtualHost>

(19 Jan '15, 18:58) mutetella
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×225
×62
×55
×27

question asked: 19 Jan '15, 13:11

question was seen: 2,901 times

last updated: 19 Jan '15, 19:00

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM