Apache, TG2 and mod_wsgi

25 views
Skip to first unread message

cu

unread,
Jan 19, 2010, 12:19:36 PM1/19/10
to TurboGears
I am new to the forum. Please bear with me if the questions are not
crystal clear.
I am having problems in deploying Apache with modwsgi for Tg2. I
followed the
instructions in http://turbogears.org/2.1/docs/main/Dep … l#example.
I am on a centos machine and the error that I get at the end of it is
"Service unavailable" when I
use the test.wsgi file.

Any input would be aprpeciated.

Thanks,
bm

Michael Pedersen

unread,
Jan 19, 2010, 1:42:07 PM1/19/10
to turbo...@googlegroups.com
In order to try to troubleshoot this, we would need the following:

* Your apache config files
* Which version of centos you are running
* Which version of Python you are running
* Any messages that are residing in your error log

With those, we can try to piece together what is happening.

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.






--
Michael J. Pedersen
My IM IDs: Jabber/pede...@icelus.tzo.com, ICQ/103345809, AIM/pedermj022171
         Yahoo/pedermj2002, MSN/pederm...@hotmail.com

Graham Dumpleton

unread,
Jan 19, 2010, 5:16:27 PM1/19/10
to TurboGears

Try reading:

http://code.google.com/p/modwsgi/wiki/ConfigurationIssues

Graham

On Jan 20, 4:19 am, cu <fluent...@gmail.com> wrote:
> I am new to the forum. Please bear with me if the questions are not
> crystal clear.
> I am having problems in deploying Apache with modwsgi for Tg2.  I
> followed the

> instructions inhttp://turbogears.org/2.1/docs/main/Dep… l#example.

cu

unread,
Jan 21, 2010, 10:31:32 PM1/21/10
to TurboGears
Here are the steps that I followed as per
http://turbogears.org/2.1/docs/main/Deployment/modwsgi+virtualenv.html.
1. I created a tg2 app 'ssl'
2. Did a 'paster quickstart ssl'
3. easy_install modwsgideploy
4. cd ssl
5. paster modwsgi_deploy
6. This creates an apache folder inside 'ssl'.
7. An apache config file gets created which is supposed to be copied
into /etc/httpd/conf.d
Here's the top part of that file:
====================================================================
#Apache configuration File
#Read README.txt
#1. This file is the apache2 config file. It should be added to your
apache config folder. If you mounting your app as a site wide package,
you can rename the file to something like 002-ssl and put anything
else that you want to be available in 001-someapp; When done copy to
apache config folder. On Debian copy to /etc/apache2/sites-available/
#cp ./apache/ssl /etc/apache2/sites-available/ssl
#a2ensite ssl


#Default location for tg2 project is /usr/local/turbogears/ssl. That
is where you should put your project. This folder should be outside of
apache location. Your package should not be installed into python site-
package.

#2. Alias/Allow apache to serve static content.
Alias /ssl/images /root/ssl/ssl/public/images
Alias /ssl/css /root/ssl/ssl/public/css
Alias /ssl/javascript /root/ssl/ssl/public/javascript

#[Optional] Embeded mode (http://example.com/ssl).For big websites
with a lot of memory and visitors. As of version 0.4.16 deamon mode is
default and it should be used on Linux. On windows use embeded mode.

#WSGIScriptAlias /ssl /usr/local/turbogears/ssl/apache/ssl.wsgi

#3. Test if modwsgi is working. Uncomment below line, and go to
http://localhost/test:
WSGIScriptAlias /test /root/ssl/apache/test.wsgi
============================================================
For starters, I am checking if test.wsgi works. But it gives
me this error: "The requested URL /test was not found on this server."
I am running on Cent 0S 5.1 and Python 2.4.
Any help would be appreciated.

R,
bm

On Jan 19, 12:42 pm, Michael Pedersen <mjpe...@gmail.com> wrote:
> In order to try to troubleshoot this, we would need the following:
>
> * Your apache config files
> * Which version of centos you are running
> * Which version of Python you are running
> * Any messages that are residing in your error log
>
> With those, we can try to piece together what is happening.
>
>
>
> On Tue, Jan 19, 2010 at 12:19 PM, cu <fluent...@gmail.com> wrote:
> > I am new to the forum. Please bear with me if the questions are not
> > crystal clear.
> > I am having problems in deploying Apache with modwsgi for Tg2.  I
> > followed the

> > instructions inhttp://turbogears.org/2.1/docs/main/Dep… l#example.


> > I am on a centos machine and the error that I get at the end of it is
> > "Service unavailable" when I
> > use the test.wsgi file.
>
> > Any input would be aprpeciated.
>
> > Thanks,
> > bm
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "TurboGears" group.
> > To post to this group, send email to turbo...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > turbogears+...@googlegroups.com<turbogears%2Bunsu...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/turbogears?hl=en.
>
> --
> Michael J. Pedersen

> My IM IDs: Jabber/peder...@icelus.tzo.com, ICQ/103345809, AIM/pedermj022171
>          Yahoo/pedermj2002, MSN/pedermj022...@hotmail.com

frankentux

unread,
Jan 24, 2010, 9:05:08 AM1/24/10
to TurboGears
On 22 Jan., 04:31, cu <fluent...@gmail.com> wrote:
> Here are the steps that I followed as perhttp://turbogears.org/2.1/docs/main/Deployment/modwsgi+virtualenv.html.

> 1. I created a tg2 app 'ssl'
> 2. Did a 'paster quickstart ssl'
> 3. easy_install modwsgideploy
> 4. cd ssl
> 5. paster modwsgi_deploy
> 6. This creates an apache folder inside 'ssl'.
> 7. An apache config file gets created which is supposed to be copied
> into /etc/httpd/conf.d
>    Here's the top part of that file:
> ====================================================================
> #Apache configuration File
> #Read README.txt
> #1. This file is the apache2 config file. It should be added to your
> apache config folder. If you mounting your app as a site wide package,
> you can rename the file to something like 002-ssl and put anything
> else that you want to be available in 001-someapp; When done copy to
> apache config folder. On Debian copy to /etc/apache2/sites-available/
> #cp ./apache/ssl /etc/apache2/sites-available/ssl
> #a2ensite ssl

Are you sure that the Apache configuration on CentOS pulls in
all .conf files from /etc/apache2/sites-available?
For instance, on openSUSE, the default Apache set up is configured to
look in /etc/apache2/vhosts.d/ for all files that end in .conf
I'm not saying that /etc/apache2/sites-available is wrong - and you
may have configured your apache setup for this, but if you're running
a default apache from CentOS, I'd say you should check out /etc/
apache2/httpd.conf to see when and how virtual hosts are set up.

You should also do a tail -f /var/log/apache2/error.log (or wherever
CentOS's Apache logs errors).

Ciaran

>
> #Default location for tg2 project is /usr/local/turbogears/ssl. That
> is where you should put your project. This folder should be outside of
> apache location. Your package should not be installed into python site-
> package.
>
> #2. Alias/Allow apache to serve static content.
> Alias /ssl/images /root/ssl/ssl/public/images
> Alias /ssl/css /root/ssl/ssl/public/css
> Alias /ssl/javascript /root/ssl/ssl/public/javascript
>

> #[Optional] Embeded mode (http://example.com/ssl).Forbig websites


> with a lot of memory and visitors. As of version 0.4.16 deamon mode is
> default and it should be used on Linux. On windows use embeded mode.
>
> #WSGIScriptAlias /ssl /usr/local/turbogears/ssl/apache/ssl.wsgi
>

> #3. Test if modwsgi is working. Uncomment below line, and go tohttp://localhost/test:

Stuart Bowness

unread,
Jan 26, 2010, 10:01:51 AM1/26/10
to TurboGears
You might find this helpful
http://simplestation.com/locomotion/mod_wsgi-with-apache-2-on-centos-4/

We're using CENTOS 4 and it definitely took us a little bit to figure
out how to set it all up.

Lukasz Szybalski

unread,
Jan 26, 2010, 12:00:40 PM1/26/10
to turbo...@googlegroups.com
When you guys do figure out where the configuration should go let me
know. On debian you put it in sites-available and then you use
command "a2ensite" to enable the particular site. On other linuxes you
might enable it your self or put it in some folder. Let me know.


I'll update the script to say:

Copy to:

Debian :
/etc/apache2/sites-available/
(enable via a2ensite yourscriptname)
(disable via a2dissite yourscriptname)

OpenSuse:
/etc/apache2/vhosts.d/ (is this 100% sure?) (how do you enable/disable)

RedHat/CentosOS? (where to put it and how to enable/disable)

Thanks,
Lucas

> To unsubscribe from this group, send email to turbogears+...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.
>
>

--
OpenLdap server for User/Client Authentication in 1min.
http://lucasmanual.com/mywiki/OpenLdap#SetupOpenLdapserver.sh

cu

unread,
Jan 26, 2010, 11:04:20 PM1/26/10
to TurboGears
I believe on CentOs, you need to put the generated apache config
folder under /etc/httpd/conf.d.
The apache folder gets generated when you execute 'paster
modwsgi_deploy'. I have copied
the folder to /etc/httpd/conf.d
Please correct me if I am wrong here.

Thanks.

> > > > turbogears+...@googlegroups.com<turbogears%2Bunsubscribe@googlegrou­ps.com>


> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/turbogears?hl=en.
>
> > > --
> > > Michael J. Pedersen
> > > My IM IDs: Jabber/peder...@icelus.tzo.com, ICQ/103345809, AIM/pedermj022171

> > >          Yahoo/pedermj2002, MSN/pedermj022...@hotmail.com- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

frankentux

unread,
Jan 27, 2010, 8:04:52 AM1/27/10
to TurboGears

On Jan 26, 6:00 pm, Lukasz Szybalski <szybal...@gmail.com> wrote:
> When you guys do figure out where the configuration should go let me
> know.  On debian you put it in sites-available and then you use
> command "a2ensite" to enable the particular site. On other linuxes you
> might enable it your self or put it in some folder. Let me know.
>
> I'll update the script to say:
>
> Copy to:
>
> Debian :
> /etc/apache2/sites-available/
> (enable via a2ensite yourscriptname)
> (disable via a2dissite yourscriptname)
>
> OpenSuse:
> /etc/apache2/vhosts.d/   (is this 100% sure?) (how do you enable/disable)

Yep, 100% sure.
If the script ends in .conf and you place it in /etc/apache2/vhosts.d/
then it will automatically be enabled (well, after rcapache2 restart).

> > For more options, visit this group athttp://groups.google.com/group/turbogears?hl=en.

KMCB

unread,
Jan 27, 2010, 8:44:44 AM1/27/10
to TurboGears
Lucas,

I recently used modwsgideploy. Which I think you created. Thanks,
It helped very much.

In Virtualhost section example.

Does it make sense to add a "Listen Port #"? Should the default
example port be greater than 1024?

Just some thoughts,

Thanks, KMCB

> > For more options, visit this group athttp://groups.google.com/group/turbogears?hl=en.

Reply all
Reply to author
Forward
0 new messages