1

I'm trying to setup my server with apache on an amazon EC2 server, but right now it isn't working. In the configuration files,

In /etc/apache2, I have:

httpd.conf:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /home/ubuntu/www/env

modwsgi.conf:

WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=Wiz group=admin threads=4 python-path=/home/ubuntu/www/env/lib/python2.7/site-packages
WSGIScriptAlias /Visus /home/ubuntu/www/env/pyramid.wsgi

<Directory /home/ubuntu/www/env>
  WSGIProcessGroup pyramid
  Order allow,deny
  Allow from all
</Directory>

In my virtualenv, I have :

pyramid.wsgi:

from pyramid.paster import get_app, setup_logging
ini_path = '/home/ubuntu/www/env/Wiz/production.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

And when I go to the base website, the default apache webpage comes up, saying the server is running, but when I go to example.com/Visus, I get a 404, when I should get my app. What's going wrong?

Wiz
  • 205
  • 2
  • 7
  • That appears to be a relatively faithful transpose from the Pyramid docs, so am I correct to assume the missing characters 'W' and 'S' at the beginning of your modwsgi.conf are not actually missing in your config? – khoxsey Aug 03 '12 at 04:11
  • @khoxsey Oh yea, its there, just copy pasted wrong. –  Aug 03 '12 at 04:23
  • Is you modwsgi.conf actually included somehow into the Apache configuration file. Add a syntax error into the file by adding a line with 'XXX' by itself and see if Apache complains when you start it. – Graham Dumpleton Aug 03 '12 at 05:38
  • And python-path=/home/ubuntu/www/env/lib/python2.7/site-packages should be redundant and WSGIPythonHome for that virtual environment should achieve the same thing. – Graham Dumpleton Aug 03 '12 at 05:39
  • @GrahamDumpleton oh wow, I tried that, and it never complained. How can I fix that? – Wiz Aug 03 '12 at 15:54
  • Apache not complaining about an obvious syntax error means that your configuration is not loading. Ubuntu is loading the site(s) in /etc/apache2/sites-enabled. Try running `apache2ctl -t -D DUMP_MODULES` to see if `mod_wsgi` is loading, and `apache2ctl -t -D DUMP_VHOSTS` to see what servers you have configured. – khoxsey Aug 03 '12 at 16:16
  • @khoxsey Well, I just moved the contents of modwsgi.conf into the main httpd.confg, and now, when I try to go the website, it just stays loading forever. No 404 though! How do I fix the not loading? I guessing theres an infinite loop in there somewhere? – Wiz Aug 03 '12 at 17:13

1 Answers1

2

From the comments it appears to me that your base setup is not working. In general, the Ubuntu model for managing Apache setups is to use the a2 tools (a2enmod, a2ensite, etc) rather than editing the base *.conf files. This can take a while to get used to, but works fine.

This page has a very good walkthrough for setting up pyramid to run on Ubuntu. It's for 11.04 but I see nothing in it incorrect for more recent versions. In particular, note how the only configuration changes for the Apache setup are in your new site config file. You don't touch the rest of the default Apache configuration.

Since you are using EC2, it's probably easiest to start up a fresh instance and follow the directions in that page. Don't forget to configure your Security Group settings to allow access to port 80.

khoxsey
  • 725
  • 4
  • 9