IP.Board Tutorials

Nginx Complete Setup.

Submitted by erevan, , Thread ID: 85954

Thread Closed
25-04-2018, 01:13 AM
#1
Hello guys, i just wanted to share my nginx setup which includes removing the index.php part, so enjoy Smile

Code:
server {

    server_name site.com www.site.com;

    root /var/www/html/forum;
    index index.php;

    location / {
        #try_files $uri $uri/ =404;
        if (!-f $request_filename){
            set $rule_0 1$rule_0;
        }
        if ($rule_0 = "1"){
            rewrite /.(js|css|jpeg|jpg|gif|png|ico|map)(?|$) /404error.php last;
        }
        if (!-f $request_filename){
            set $rule_1 1$rule_1;
        }
        if (!-d $request_filename){
            set $rule_1 2$rule_1;
        }
        if ($rule_1 = "21"){
            rewrite /. /index.php last;
        }
    }

    location ~ \.php$ {

# remember to change this to your specific php version.
      fastcgi_pass unix:/run/php/php7.1-fpm.sock;
      include snippets/fastcgi-php.conf;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }

    location ~ /\.ht {
        deny all;
    }

}

RE: Nginx Complete Setup.

#2
Thanks for that it is a help... (I have to write some more to be able to post).

RE: Nginx Complete Setup.

#3
Thanks for your post, I'm newbie for both of them :(

RE: Nginx Complete Setup.

#4
Thanks, good job for you to help out others! Keep it going, its great, man.

RE: Nginx Complete Setup.

#5
thanks for that, apache is a pain!

Users browsing this thread: 1 Guest(s)