<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Dan Siemon &#187; mod_wsgi</title>
	<atom:link href="http://www.coverfire.com/archives/tag/mod_wsgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coverfire.com</link>
	<description>Thoughts and musings</description>
	<lastBuildDate>Sun, 05 Feb 2012 18:33:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/ca/</creativeCommons:license>		<item>
		<title>Django/mod_wsgi on Fedora 12</title>
		<link>http://www.coverfire.com/archives/2010/06/13/djangomod_wsgi-on-fedora-12/</link>
		<comments>http://www.coverfire.com/archives/2010/06/13/djangomod_wsgi-on-fedora-12/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 17:59:07 +0000</pubDate>
		<dc:creator>Dan Siemon</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[mod_wsgi]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://www.coverfire.com/?p=752</guid>
		<description><![CDATA[I recently deployed a Django application with mod_wsgi on my server which runs Fedora 12. Since this required a bit more configuration than a standard Apache virtual host I thought it might be useful to document the configuration for others. &#8230; <a href="http://www.coverfire.com/archives/2010/06/13/djangomod_wsgi-on-fedora-12/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently deployed a <a title="Django" href="http://www.djangoproject.com/">Django</a> application with <a title="mod_wsgi" href="http://code.google.com/p/modwsgi/">mod_wsgi</a> on my server which runs Fedora 12. Since this required a bit more configuration than a standard Apache virtual host I thought it might be useful to document the configuration for others.</p>
<h1>SELinux</h1>
<p>While <a title="SELinux" href="http://en.wikipedia.org/wiki/Security-Enhanced_Linux">SELinux</a> can be a little annoying if you don&#8217;t understand how it works it is a very powerful security layer that should not be disabled. In order to get the Django/mod_wsgi application working I had to modify a couple of SELinux booleans which give Apache extra permissions.</p>
<pre>setsebool httpd_tmp_exec on
setsebool httpd_can_network_connect on
</pre>
<h1>mod_wsgi configuration</h1>
<p>The default configuration tries to create the mod_wsgi sockets in a directory that SELinux does not allow Apache access to. You can change this by adding the following line to /etc/httpd/conf.d/wsgi.conf.</p>
<pre>WSGISocketPrefix run/mod_wsgi
</pre>
<h1>Apache virtual host configuration</h1>
<p>Below is the Apache virtual host configuration. Note that I have chosen to use mod_wsgi&#8217;s daemon mode and processes instead of threads because some of the libraries I&#8217;m using are not thread safe.</p>
<pre>&lt;VirtualHost *:80&gt;
 ServerAdmin dan@example.com
 DocumentRoot /home/vhosts/example.com/
 ServerName www.example.com

 Alias /robots.txt /home/vhosts/example.com/example/web/static/robots.txt
 Alias /favicon.ico /home/vhosts/example.com/example/web/static/favicon.ico

 # Static files.
 Alias /static /home/vhosts/example.com/example/web/static

 # Admin static files.
 Alias /media /home/vhosts/example.com/dependencies/Django-1.2.1/django/contrib/admin/media

 WSGIScriptAlias / /home/vhosts/example.com/example/web/example/django.wsgi
 WSGIDaemonProcess example.com processes=15 threads=1 display-name=%{GROUP}
 WSGIProcessGroup example.com

 ErrorLog logs/example.com-error_log
 LogFormat "%a %l \"%u\" %t %m \"%U\" \"%q\" %p %&gt;s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" custom_log
 CustomLog logs/example.com-access_log combinedio
&lt;/VirtualHost&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.coverfire.com/archives/2010/06/13/djangomod_wsgi-on-fedora-12/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

