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'm new to nginx, and I'm trying to make my first server run. I followed this guide as I'm trying to use it for a multisite wordpress site.

After installing everything, I get a 500 Internal server error. If I check logs, I see this:

012/09/27 08:55:54 [error] 11565#0: *8 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: xxx.xxx.xxx.xxx, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.mydomain.com"
2012/09/27 08:59:32 [error] 11618#0: *1 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: xxx.xxx.xxx.xxx, server: localhost, request: "GET /phpmyadmin HTTP/1.1", host: "www.mydomain.com"

My conf files are the following:

nano /etc/nginx/sites-available/mydomain.com

server {
    listen       80 default_server;
    server_name  mydomain.com *.mydomain.com;
    root /srv/www/aciup.com/public;

    access_log   /srv/www/mydomain.com/log/access.log;
    error_log    /srv/www/mydomain.com/log/error.log;

 location / {
        index index.php;
        try_files $uri $uri/ /index.php?$args;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    # Directives to send expires headers and turn off 404 error logging.
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 24h;
        log_not_found off;
    }

    # this prevents hidden files (beginning with a period) from being served
              location ~ /\.          { access_log off; log_not_found off; deny all; }

    # Pass uploaded files to wp-includes/ms-files.php.
    rewrite /files/$ /index.php last;

    if ($uri !~ wp-content/plugins) {
        rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
    }

    # Rewrite multisite '.../wp-.*' and '.../*.php'.
    if (!-e $request_filename) {
        rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
        rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
        rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
    }

    location ~ \.php$ {
        client_max_body_size 25M;
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        include        /etc/nginx/fastcgi_params;
    }
}

nano /etc/nginx/nginx.conf

user              www-data;
worker_processes  4;
worker_cpu_affinity 0001 0010 0100 1000;
error_log         /var/log/nginx/error.log;
pid               /var/run/nginx.pid;

events {
    worker_connections  2048;
}

http {
    include     /etc/nginx/mime.types;
    access_log  /var/log/nginx/access.log;

    sendfile            on;
    tcp_nopush          on;
    keepalive_timeout   5;
    tcp_nodelay         on;
    server_tokens       off;

    gzip          on;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable  "MSIE [1-6]\.(?!.*SV1)";

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

Any help will be appreciated.

share|improve this question
1  
Why voting down without comments? No sense –  chifliiiii Sep 27 '12 at 14:53
1  
I don't have an answer for this, but here's what I'd try: Search the error message ('rewrite or internal redirection cycle' is probably the string to search for) both on the wider web and on this site (and Stack Overflow). Try commenting out all the rewrite directives in the site configuration and adding them back one by one until you find the one that causes the error. –  pjmorse Oct 4 '12 at 13:53
1  
Also, if those searches and troubleshooting steps help you narrow down your problem, come back and edit your question! A more specific question ("Why is this rewrite rule causing errors?") will get more helpful answers than a general one ("What's wrong?") –  pjmorse Oct 4 '12 at 13:57

1 Answer 1

up vote 0 down vote accepted

The first thing you're missing is a 404 error handler. WordPress Multisite pretty much requires this.

error_page 404 /index.php;
share|improve this answer

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.