Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Files over 100kb not served using, nginx proxy, apache, mod_wsgi

We are in the process of migrating a site to a new server. We have the site with virtualenv set up, apache modwsgi is installed and the django site is loaded (we can point to the domain and get the html back). Unfortunately no static files larger than 100Kb is being served.

I suspect this has something to do with the apache config, but on the same apache server we also have a bunch of php sites (also migrated form old server) which are all working as normal and all media files larger than 100k is served up perfectly fine.

Does anyone know what the issue may be?

Extra info: Just found out that nginx is running as a reverse proxy on the server. Plesk is also used by the client to set up the sites etc.

*EDIT There are no error messages in the logs, but I did notice that the static files a being looked for in the wrong location:

[29/May/2013:10:48:05 +0100] "GET /internal-nginx-static-locationmedia/cache/artwork/_MG_4080_image_display.jpg HTTP/1.0" 500 609 "http://www.calluminnes.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36"

There is a missing '/' between internal-nginx-static-location and media

How can I fix this path? Here is my apache vhost.conf:

RewriteEngine On
RewriteCond %{HTTP_HOST} !www.calluminnes.com
RewriteRule ^(.*)$ http://www.calluminnes.com$1 [L,R=301]

<Directory /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/apache>
        # Order deny,allow
        # Allow from All
#       Deny from All
#       Allow from 87.194.184.116
</Directory>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio

DocumentRoot /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/

Alias /robots.txt /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/media/robots.txt
Alias /favicon.ico /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/media/favicon.ico
Alias /media/ /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/media/
Alias /static/ /var/www/vhosts/calluminnes.com/httpdocs/calluminnes/static/

# NOTE: I'm just hiding some potentially sensitive user and group names here
WSGIDaemonProcess <user> processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup <group>

And here is the nginx config auto generated by plesk:

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.


server {
    listen <ip_address>:443 ssl;

    server_name calluminnes.com;
    server_name www.calluminnes.com;
    server_name ipv4.calluminnes.com;
    # aliases
    server_name calluminnes.co.uk;
    server_name www.calluminnes.co.uk;
    server_name calluminnes.org;
    server_name www.calluminnes.org;

    ssl_certificate             /opt/psa/var/certificates/certv3SLXET;
    ssl_certificate_key         /opt/psa/var/certificates/certv3SLXET;
    ssl_session_timeout         5m;

    ssl_protocols               SSLv2 SSLv3 TLSv1;
    ssl_ciphers                 HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    client_max_body_size 128m;

    location / { # IPv6 isn't supported in proxy_pass yet.
        proxy_pass https://<ip_address>:7081;

        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;
    }

    location /internal-nginx-static-location/ {
        alias      /var/www/vhosts/calluminnes.com/httpdocs/;
        access_log /var/www/vhosts/calluminnes.com/statistics/logs/proxy_access_ssl_log;
        add_header X-Powered-By PleskLin;
        internal;
    }
}

server {
    listen <ip-address>:443 ssl;
    server_name webmail.calluminnes.com;
    # aliases
    server_name webmail.calluminnes.co.uk;
    server_name webmail.calluminnes.org;

    ssl_certificate             /opt/psa/var/certificates/certv3SLXET;
    ssl_certificate_key         /opt/psa/var/certificates/certv3SLXET;
    ssl_session_timeout         5m;

    ssl_protocols               SSLv2 SSLv3 TLSv1;
    ssl_ciphers                 HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    client_max_body_size 128m;

    location / { # IPv6 isn't supported in proxy_pass yet.
        proxy_pass https://<ip-address>:7081;

        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;
    }

    location /internal-nginx-static-location/ {
        alias      /var/www/vhosts/calluminnes.com/httpdocs/;
        access_log /var/www/vhosts/calluminnes.com/statistics/logs/proxy_access_ssl_log;
        add_header X-Powered-By PleskLin;
        internal;
    }
}

server {
    listen <ip-address>:443 ssl;
    server_name webmail.calluminnes.com;
    # aliases
    server_name webmail.calluminnes.co.uk;
    server_name webmail.calluminnes.org;

    ssl_certificate             /opt/psa/var/certificates/certv3SLXET;
    ssl_certificate_key         /opt/psa/var/certificates/certv3SLXET;
    ssl_session_timeout         5m;

    ssl_protocols               SSLv2 SSLv3 TLSv1;
    ssl_ciphers                 HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;
    client_max_body_size 128m;

    location / { # IPv6 isn't supported in proxy_pass yet.
        proxy_pass https://<ip-address>:7081;

        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        access_log /var/www/vhosts/calluminnes.com/statistics/logs/webmail_access_ssl_log;
    }
}


server {
    listen <ip-address>:80;

    server_name calluminnes.com;
    server_name www.calluminnes.com;
    server_name ipv4.calluminnes.com;
    # aliases
    server_name calluminnes.co.uk;
    server_name www.calluminnes.co.uk;
    server_name calluminnes.org;
    server_name www.calluminnes.org;


    client_max_body_size 128m;

    location / { # IPv6 isn't supported in proxy_pass yet.
        proxy_pass http://<ip-address>:7080;

        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;
    }

    location /internal-nginx-static-location/ {
        alias      /var/www/vhosts/calluminnes.com/httpdocs/;
        access_log /var/www/vhosts/calluminnes.com/statistics/logs/proxy_access_log;
        add_header X-Powered-By PleskLin;
        internal;
    }
}

server {
    listen <ip-address>:80;
    server_name webmail.calluminnes.com;
    # aliases
    server_name webmail.calluminnes.co.uk;
    server_name webmail.calluminnes.org;

    client_max_body_size 128m;

    location / { # IPv6 isn't supported in proxy_pass yet.
        proxy_pass http://<ip-address>;

        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        access_log /var/www/vhosts/calluminnes.com/statistics/logs/webmail_access_log;
    }
}
share|improve this question
    
Could you provide nginx configs, any messages in error logs regarding these files. Not being served means error page or something else? –  Andrei Mikhaltsov May 28 '13 at 15:28
    
provided new information from some debugging yesterday. Also added my vhost.conf config –  Andre May 29 '13 at 9:56
add comment

2 Answers

Seems some misconfiguration in nginx block. If you have possibility to change plesk's nginx confing try completely removing location with internal-nginx-static-location and replace it with: (this will instruct nginx to intercept requests to static files and proxy other requests to backend)

location ~* \.(jpeg|jpg|gif|png|css|js|pdf|txt|tar|swf|flv|ico|svg|mp3|avi|html|woff)$ {
   root /var/www/vhosts/calluminnes.com/httpdocs/;
   expires 3d;
}
share|improve this answer
    
Unfortunately this didn't seem to work. In the end we just disabled nginx using plesk's management commands /usr/local/psa/admin/bin/nginxmng --disable. Which solved the problem. Though I dont like that kind of solution. –  Andre Jun 4 '13 at 12:00
add comment
up vote 0 down vote accepted

In the end we just opted to turn off nginx support in plesk, /usr/local/psa/admin/bin/nginxmng --disable, which solved the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.