0

I know this question has been posted many times, but even with the help of those answers, I can't seem to figure this out.

I'm a freelance web developer and just started maintaining and administering an existing vBulletin forum site. The site has hundreds of thousands of members and millions of posts already on it, so to avoid catastrophe, I thought I should setup a dev environment to work off of rather than mucking around with the real production site.

But being a complete newbie to nginx (the server used on production), I can't figure out why I'm constantly getting the error mentioned in the title.

Here's the site's config file:

server {
    listen   80; ## listen for ipv4; this line is default and implied

    root /home/bolt/domains/bolt.cd/public_html;
    index forum.php index.html;

    # Make site accessible from http://localhost/
    server_name bolt.cd www.bolt.cd;

    location / {
    #    try_files $uri $uri/ /index.php;
    }

    location /board/ {
        rewrite ^/board/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /board/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
        try_files $uri $uri/ /board/vbseo.php?$args;
        access_log off;
    }

    location /board/vbseo/(packages|vb|includes|resources/html|resources/xml)/ {
        allow 127.0.0.1;
        deny all;
    }

#   location ~ /board/(.*\.php)$ {
#       rewrite ^/board/(.*)$ /board/vbseo.php last;
#   }

    location /board/(neverfind-72891|modareaz-3782|install)/ {
        auth_basic "Private";
        auth_basic_user_file /home/bolt/.htpasswd;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index forum.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_intercept_errors on;
        fastcgi_ignore_client_abort off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffers 256 16k;
        fastcgi_buffer_size 32k;
        fastcgi_temp_file_write_size 256k;
    }

    location = /robots.txt { access_log off; log_not_found off; }
    location = /favicon.ico { access_log off; log_not_found off; }
    location ~ /\. { deny all; }
}

And every request to {root url}/board returns a 500 error page, with the following logged in /var/log/nginx/error.log:

2016/10/26 07:31:37 [error] 4760#0: *4 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 10.0.2.2, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost:6544", referrer: "http://localhost:6544/board"

I'm pretty sure I've installed PHP-FPM correctly, although it could be a problem with that, or with the php.ini config file, but I'm pretty certain the error is somewhere in that nginx config file.

MTIA for any help with this frustrating issue! :-)

Kenny83
  • 103
  • 6
  • I don't understand the root cause of the error, but half of the `location` blocks are invalid. You can use parenthesised lists in a regular expression location block but not a prefix location block. See [this document](http://nginx.org/en/docs/http/ngx_http_core_module.html#location) for details. – Richard Smith Oct 27 '16 at 15:36
  • @RichardSmith Hmm that's very interesting...considering I pulled that nginx config file straight from the production server, and everything seems to work fine there! Anyway I appreciate you taking the time to comment, but I've found another way around this problem. Thanks anyway :-) – Kenny83 Oct 28 '16 at 08:50

0 Answers0