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.

I am having a bit of problem of configuring Nginx in place of Apache, so that it served Mumble Django to clients. I have vhosts configs for both Apache and Lighttpd - let me put them here side by side, to save you a click :) . Apache2 utilized WSGI to run Django Python as CGI. Lighttpd, as far as I can see, works like Nginx/PHP-FPM.

Dedicated Apache2 vhosts - config:

<VirtualHost *:80>
        ServerName              example.com
        ServerAlias             www.example.com

        Alias                   /static/admin/  /usr/share/pyshared/django/contrib/admin/static/admin/
        Alias                   /static/        /srv/mumble-django/htdocs/
        Alias                   /mumble/media/  /srv/mumble-django/pyweb/mumble/media/

        WSGIScriptAlias         /               /srv/mumble-django/mumble-django.wsgi
        WSGIDaemonProcess       mumble-django threads=25
        WSGIProcessGroup        mumble-django
        WSGIScriptReloading     Off

        # Cache optimization - not necessarily needed for MD, but nice to have :)
        FileETag None
        <IfModule mod_headers.c>
                Header unset ETag

                <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
                        Header set Cache-Control "max-age=86400, must-revalidate"
                </FilesMatch>

                <IfModule mod_deflate.c>
                        # compress content
                        AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript image/png image/jpeg image/gif
                        # properly handle requests coming from behind proxies
                        Header append Vary User-Agent
                </IfModule>
        </IfModule>
</VirtualHost>

Lighttpd config:

server.document-root = "/usr/local/www/mumble-django"
  alias.url = (
    "/static" => "/usr/local/www/mumble-django/htdocs/",
    "/media"  => "/usr/local/lib/python2.6/site-packages/django/contrib/admin/media/"
  )
  url.rewrite-once = (
    "^(/media.*)$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/.*)$" => "/mumble-django.fcgi$1",
  )
  fastcgi.server = (
    "/mumble-django.fcgi" => (
      "" => (
        "socket" => "/tmp/mumble-django.sock",
        "check-local" => "disable"
      )
    )
  )

And my shameful Nginx config file, which I converted, is this:

server {
    listen 80;
    server_name mumble-web-ui.imanov.name;
    server_name_in_redirect on; # SEO: Avoid different host-names!
    server_tokens off;
    root /home/shehi/www-data/subdomains/mumble_web_ui;
    merge_slashes on;
    msie_padding on;
    client_max_body_size 64M;
    index index.php;
    error_log /home/shehi/logs/error_log debug;

    location /static
    {
        alias /home/shehi/www-data/subdomains/mumble_web_ui/htdocs/;
        internal;
    }

    location /media
    {
        alias /home/shehi/www-data/subdomains/mumble_web_ui/pyweb/mumble/media/;
        internal;
    }

    location /
    {
#       rewrite ^(/.*)$ /mumble-django.fcgi$1 last;
#       try_files $uri $uri/ /mumble-django.fcgi$uri;
        gzip on;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        include fastcgi_params;
    }
}

Apparently, my configuration ends up in infinite loops:

http://mumble-web-ui.imanov.name/mumble/mumble/.. .../mumble/mumble/ 

So, in short, what is it that I am doing wrong here? Thank you all for all help in advance!

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.