Well I was wondering from last couple of hours how to enable the clean url for drupal8 in my local nginx server. It is also works for drupal 7.
Its very simple do edit the "/etc/nginx/sites-available/default" , Please type the following command on terminal.
$ sudo gedit /etc/nginx/sites-available/default
Its very simple do edit the "/etc/nginx/sites-available/default" , Please type the following command on terminal.
$ sudo gedit /etc/nginx/sites-available/default
And search for the line text "try_files $uri $uri/ =404" under location/ server configuration area and comment it. Then add these lines to below that, as like
location/ {
..........
............
#try_files $uri $uri/ =404; <============= You need to comment this line
expires max;
try_files $uri $uri/ @rewrite;
...........................
.............................
}
After that add location @rewrite, as like
location @rewrite{
rewrite ^/(.*)$ /index.php?q=$1;
}
Save the file and exit .
You need to check the syntax is correct or not. For that you need type the following command on terminal
$ sudo nginx -t
If it is correct, then you have to restart the nginx server using following command on your terminal
$ sudo service nginx restart
JThank you. I'am just having the home page
ReplyDelete