NameVirtualHost *:80
NameVirtualHost *:443


<VirtualHost *:443>
	ServerName example.com
	ServerAdmin example@mail.com
	ServerSignature email
	
	Alias /media /usr/share/nginx/media
	Alias /admin_media /usr/lib/python2.6/site-packages/django/contrib/admin/media/
	
	<Location "/">
		SetHandler python-program
		PythonHandler django.core.handlers.modpython
		SetEnv DJANGO_SETTINGS_MODULE tcms.settings.product
		PythonDebug Off
		PythonPath "['/usr/share/tcms']+sys.path"
	</Location>
	
	<Location "/media">
		SetHandler None
		RewriteEngine on
		RewriteCond %{HTTP_USER_AGENT} “.*Safari.*” [OR]
		RewriteCond %{HTTP:Accept-Encoding} !gzip
		RewriteRule (.*)\.jgz$ $1\.js [L]
		AddType “text/javascript;charset=UTF-8″ .jgz
		AddEncoding gzip .jgz
	</Location>
	
	<Location "/admin_media">
		SetHandler None

		# Disable auth on the static content, so that we're aren't forced to
		# use Kerberos.  Doing so would remove "Expires" headers from the static
		# content, which would lead to poor page-load times.
		AuthType none
		Satisfy Any
		Allow from All

		# Many file types are likely to benefit from compression
		# Enable gzip compression on them:
		AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/x-javascript text/css

		# Set far-future Expires headers on static content
		# (trac 184):
		ExpiresActive On
		ExpiresDefault "access plus 10 years"
	</Location>
</VirtualHost>

<VirtualHost *:80>
	ServerName example.com
	ServerAdmin example@mail.com
	ServerSignature email
	
	<IfModule mod_rewrite.c>
		RewriteEngine on
		RewriteCond %{SERVER_NAME} ^example.com$
		RewriteCond %{SERVER_PORT} ^80$
		RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
	</IfModule>
</VirtualHost>
