IP.Board Tutorials

Nginx Complete Setup.

Submitted by erevan, , Thread ID: 85954

Thread Closed
erevan
Newbie
Level:
0
Reputation:
0
Posts:
19
Likes:
1
Credits:
6
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.

LordGrep
Novice
Level:
0
Reputation:
0
Posts:
36
Likes:
2
Credits:
9
30-07-2018, 03:45 PM
#2
Thanks for that it is a help... (I have to write some more to be able to post).

RE: Nginx Complete Setup.

jayzaa
Lurker
Level:
0
Reputation:
0
Posts:
1
Likes:
0
Credits:
1
11-08-2018, 09:29 AM
#3
Thanks for your post, I'm newbie for both of them :(

RE: Nginx Complete Setup.

imgod
Novice
Level:
0
Reputation:
0
Posts:
22
Likes:
5
Credits:
52
16-08-2018, 12:03 PM
#4
Thanks, good job for you to help out others! Keep it going, its great, man.

RE: Nginx Complete Setup.

uge
Lurker
Level:
0
Reputation:
0
Posts:
2
Likes:
0
Credits:
2
26-01-2022, 10:38 AM
#5
thanks for that, apache is a pain!

Users browsing this thread: 1 Guest(s)