Friday, March 11, 2011

Help with Apache/Nginx combo

Hi,

I know this topic was discussed a lot, but in every post for this
topic there are diffrent configuration and this stop helping for me.

Long story short : I changed DEBUG = True to False and all static
media are gone, so this is something wrong in web server conf.

#####settings.py#####

import os.path
PROJECT_DIR = os.path.dirname(__file__)

MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')

MEDIA_URL = 'http://aplikacje/media/'

ADMIN_MEDIA_PREFIX = '/media/admin/'

####nginx configuration ########
nginx.conf:

user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";


upstream webcluster {
server aplikacje:8000;
}


include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

#sites conf :

server {
listen 80;
server_name media.aplikacje;
access_log /var/log/nginx/aplikacje.media.access.log;
location / {
autoindex on;
index index.html;
root /var/www/web_aplikacje/web_aplikacje/media;
}

}
server {
listen 80;
server_name aplikacje;
access_log /var/log/nginx/aplikacje.django.access.log;
if ($host !~* "^aplikacje") {
rewrite ^(.*)$ http://aplikacje/$1 permanent;
break;
}
location / {
proxy_pass http://webcluster;
include /etc/nginx/proxy.conf;
}
}

#######Apache conf ######
<VirtualHost *:8000>

#Basic Setup
ServerAdmin maciej.jablonski@hydrosolar.pl
ServerName aplikacje
ServerAlias media.aplikacje
ServerAlias aplikacje

DocumentRoot /var/www/web_aplikacje/web_aplikacje/media

WSGIScriptAlias / /var/www/web_aplikacje/web_aplikacje/apache/
django.wsgi


<Directory /var/www/web_aplikacje/web_aplikacje/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

Server is for the intranet use only. I have dns pointing to http://aplikacje/
and django works fine, only media ( css, img, admin media) gone.

I will be every thankful if someone can point what is wrong with this
conf a why it is wrong.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate