Pandos

  • Living on the edge of Wedge
  • Posts: 635
PrettyURLs on nginx
« on January 31st, 2014, 11:19 AM »Last edited on February 1st, 2014, 02:37 AM
Setup PrettyURls for nginx is straight forward.
It's the same setup as for Wordpress.
Thanks to MultiformeIngegno
Code: [Select]
server {
   server_name .DOMAIN.TLD;
   index index.php;
   root /var/www/WEDGE_INSTALLATION_DIR;

   error_log /var/www/WEDGE_INSTALLATION_DIR/error.log;
   
   #Specify a charset
   charset utf-8;
   
   location / {
      try_files $uri $uri/ /index.php?$args;
   }

   location ~ \.php$ {
      try_files $uri =404;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_read_timeout 180;
      include fastcgi.conf;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
   }
   
   ## Deny dot files:
   location ~ /\. {
      deny all;
   }

   ## favicon.ico not found
   location = /favicon.ico {
      access_log off;
      log_not_found off;
   }

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

}
# dpkg-reconfigure brain
error: brain is not installed or configured

Nao

  • Dadman with a boy
  • Posts: 15,997
Re: PrettyURLs on nginx
« Reply #1, on February 1st, 2014, 12:11 AM »
Is it worth including the '.ht' lines, considering dot-folders were forbidden altogether in the rule before..?

Pandos

  • Living on the edge of Wedge
  • Posts: 635
Re: PrettyURLs on nginx
« Reply #2, on February 1st, 2014, 02:03 AM »
I don't think so.
First rule should be enough....

MultiformeIngegno

  • Posts: 1,337

Pandos

  • Living on the edge of Wedge
  • Posts: 635