Apache Deployment issues on Ubuntu

8 views
Skip to first unread message

Johanm

unread,
Dec 6, 2008, 7:18:38 PM12/6/08
to web2py Web Framework
Hi Guys,
I'm having some serious issues deploying my web2py project through
Apache.
Disclaimer: I'm in no shape or form a linux / apache guy but i know my
basics.

I'm following the install guide in the book and have all modules
installed and ssl works (self signed cert)

now i have two config files in my /etc/apache2/sites-available

default and web2py (i have an ssl config file as well which i've moved
elsewhere but it works with the server.crt etc)

whenever i try to get my application running i get the following
error

NameVirtualHost *:80 has no VirtualHosts

now i did some research on it and i assume its because i have multiple
of these setups in config files. but i dont!
the only way i can get rid of it is to comment out that line but that
wont solve anything. (I can also remove the links to site-enabled for
default but instead of two of these i then get one.)

I get to a folder structure of my web2py applications but thats it.

what am i doing wrong?
I've spent like 30 hours on this this week and im about to eat my own
hand if i dont solve this.

thanks,
Johan

Johanm

unread,
Dec 6, 2008, 7:44:08 PM12/6/08
to web2py Web Framework
Attaching my web2py config file (havent bothered about SSL stuff yet,
just want to get the initial stuff working)
the owner of the folders is www-data

### for requests on port 80
NameVirtualHost *:80
<VirtualHost *:80>
### set the servername
ServerName localhost
### alias the location of applications (for static files)
Alias / /var/www/web2py/applications/
### setup WSGI
WSGIScriptAlias / /var/www/web2py/wsgihandler.py
WSGIDaemonProcess web2py user=www-data group=www-data \
home=/var/www/web2py/ \
processes=10 maximum-requests=500
### static files do not need WSGI
<LocationMatch "ˆ(/[\w_]*/static/.*)">
Order Allow,Deny
Allow from all
</LocationMatch>
### everything else goes over WSGI
<Location "/">
Order deny,allow
Allow from all
WSGIProcessGroup web2py
</Location>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog /var/log/apache2/access.log common
</VirtualHost>

voltron

unread,
Dec 7, 2008, 3:00:34 AM12/7/08
to web2py Web Framework
Hello Johann,

I think you have toi move the "servername" directiove out of the
virualhost config block as in


ServerName "www.yourdomain.com"
NameVirtualHost *:80

<VirtualHost *:80>
#
=========================================================================
# Apache server settings
# Author : xxxxx
# Date : June 2008
#
=========================================================================

ServerAdmin root@xxxxxxx
ServerSignature Off



and so on

voltron

unread,
Dec 7, 2008, 3:08:11 AM12/7/08
to web2py Web Framework
Hmm, I re-read your post, your config is almost like the one I posted.
Are you using Debian/Ubuntu? You can use one config file for all your
Vhosts actually, if you intend to split files, the directives at the
top:

ServerName "www.yourdomain.com"
NameVirtualHost *:80

should only exits in the default domain config file otherwise there
will be a conflict. I hope that helped

achipa

unread,
Dec 7, 2008, 6:25:17 AM12/7/08
to web2py Web Framework
Which distribution are you using ? Note that on newer ubuntu/debian
configs the namevirtualhost directive is actually in ports.conf by
default, you don't need to put it in your site-config (as then you are
doubling it). Also, you might want to comment out ServerName if this
is your default config and you don't have any other sites.

Johanm

unread,
Dec 10, 2008, 7:26:35 PM12/10/08
to web2py Web Framework
Oops sent the last reply to the author. sorry about that.
I'm a little drugged up on cold medicine.

So I am running Ubuntu 8.10 Server which just like you suggested uses
ports.conf
however I cant seem to get my WSGI to fire on my web2py
the setup runs acceptably i think sine i get in to the folder i have
configured but the
.py files seem to remain untouched

any ideas on how to troubleshoot why its not hitting?
and yes i am running web2py on port 8000

thanks again for the help

Johan

achipa

unread,
Dec 11, 2008, 9:42:40 AM12/11/08
to web2py Web Framework
Just to clear things up... You are running web2py on port 8000 for
development or... ? If you're going through WSGI there is no web2py
port to listen to, the communication with apache is 'internal'.

Here's how my default config looks like on an ubuntu machine (note: I
actually created a web2py user and group, if you don't have this, just
use the web server's www-data user/group). Don't forget to chown the
web2py folder to the user you specify here otherwise web2py won't be
able to start up.

<VirtualHost *:80>
WSGIScriptAlias / /var/www/web2py/wsgihandler.py
WSGIDaemonProcess web2py user=web2py group=web2py home=/var/
www/web2py processes=1 maximum-requests=1000

ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined

</VirtualHost>

achipa

unread,
Dec 11, 2008, 9:46:05 AM12/11/08
to web2py Web Framework
Forgot to add, make sure you actually have mod_wsgi (dpkg -l | grep
mod-wgsi) installed AND enabled (ls -l /etc/apache2/mods-enabled/ |
grep wsgi). As WSGI is a picky beast, always do '/etc/init.d/apache2'
restart if change the config (apache2ctl, kill -HUP and similar don't
always do the job)

Johanm

unread,
Dec 11, 2008, 5:48:26 PM12/11/08
to web2py Web Framework
yeah that works!
did get an irrecoverable error because i didnt set chmod 777 on
sessions and errors folders.

fantastic! thank you very very much!

for the record. It would be good if the install guide was more up to
date and covered all possible versions of Apache

Johan


On Dec 11, 6:46 am, achipa <attila.cs...@gmail.com> wrote:
> Forgot to add, make sure you actually have mod_wsgi (dpkg -l | grep
> mod-wgsi) installed AND enabled (ls -l /etc/apache2/mods-enabled/ |
> grep wsgi). As WSGI is a picky beast, always do '/etc/init.d/apache2'
> restart if change the config (apache2ctl, kill -HUP and similar don't
> always do the job)
>
> On Dec 11, 3:42 pm, achipa <attila.cs...@gmail.com> wrote:
>
> > Just to clear things up... You are running web2py  on port 8000 for
> > development or... ? If you're going through WSGI there is no web2py
> > port to listen to, the communication with apache is 'internal'.
>
> > Here's how my default config looks like on anubuntumachine (note: I
> > > So I am runningUbuntu8.10 Server which just like you suggested uses
Reply all
Reply to author
Forward
0 new messages