Hello, i have configured apache with mod_wsgi to serve django and the
images are supposed to be served by nginx on the front and proxy
requests not found in the static filesystem to apache. Today i
accidentally discovered that apache is still capable of serving media
files. I think that ideally we need a way to disable image serving
from apache completely. Below is my configuration for both nginx and
apache. What am i doing wrong?
***BEGIN NGINX CONFIG***
upstream django_mysite_com {
server www.mysite.com:11001;
}
server {
listen 80;
server_name mysite.com;
rewrite ^/(.*) http://www.mysite.com/$1 permanent;
}
server {
listen 80;
server_name www.mysite.com;
access_log /home/usr10/var/log/nginx/
mysite.com.access.log;
error_log /home/usr10/var/log/nginx/mysite.com.error.log;
location / {
root /home/usr10/var/www/domains/mysite.com/
public_html
;
index index.html;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP
$remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
if (!-f $request_filename) {
proxy_pass http://django_mysite_com;
}
}
}
***END NGINX CONFIG***
***BEGIN APACHE CONFIG***
<VirtualHost *:11001>
ServerAdmin webmas...@localhost
ServerName www.mysite.com
WSGIDaemonProcess mysite user=usr10 group=usr10 threads=25
WSGIProcessGroup mysite
WSGIScriptAlias / /home/usr10/home/usr10/domains/mysite.com/
djangoproject/server/django.wsgi
<Directory /home/usr10/home/usr10/domains/mysite.com/
djangoproject/server>
Order deny,allow
Allow from all
</Directory>
ErrorLog /home/red4/var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn
CustomLog /home/usr10/var/log/apache2/mysite.com.access.log
combined
</VirtualHost>
***END APACHE CONFIGURATION***
The problem i discovered today is that if i don't place the media
files in "/home/usr10/var/www/domains/mysite.com/public_html/
static/" (we use a symlink actually) and the django "urls.py" file has
the below line, the media files are served by apache
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
What am i doing wrong?
Thanks in advance.
Sean
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.