[SOLVED] nginx and Simple URL's

Help and support in getting the EVE-Dev Killboard to run on your site.
Post Reply
omni
Greenhorn
Posts: 15
Joined: Sun Mar 10, 2013 23:07

[SOLVED] nginx and Simple URL's

Post by omni » Wed Dec 10, 2014 02:21

Basically the issue comes down to nginx, by default, not prepping the server variable PATH_INFO correctly.

So its a simple solution, follow the guide here: http://wiki.nginx.org/PHPFcgiExample

Here is my fastcgi_params

Code: Select all

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_param  PATH_INFO          $fastcgi_path_info;
fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

fastcgi_pass_request_body off;
client_body_in_file_only clean;
fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
I do have a few other options at the bottom, that you will not need, although I do recommend adding it so google what I added at the bottom :)

Here is an example site config from nginx.conf

Code: Select all

    server {
        listen       80;
        listen       [::]:80;
        server_name  kb.almostawesome.org;

        root   /srv/http/kbalmostawesomeorg/public_html;

        location ~ /(cron|cache) {
            deny all;
            return 404;
        }

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

        location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;

            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }

            fastcgi_pass php;
            fastcgi_index index.php;
            fastcgi_intercept_errors on;
            include fastcgi_params;
        }

        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
            access_log off;
            log_not_found off;
            expires max;
        }

        location = /robots.txt {
            access_log off;
            log_not_found off;
        }

        location ~ /\. {
            deny  all;
            access_log off;
            log_not_found off;
        }
    }

Post Reply

Return to “Support”

Who is online

Users browsing this forum: No registered users and 5 guests