Skip to content

Instantly share code, notes, and snippets.

@janmejai
Created October 9, 2016 10:02
Show Gist options
  • Save janmejai/6a97a1ff3c9c92e6fa136f00e62508b6 to your computer and use it in GitHub Desktop.
Save janmejai/6a97a1ff3c9c92e6fa136f00e62508b6 to your computer and use it in GitHub Desktop.
NGINX Rewrite rules for CodeIgniter
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name domainname.com;
root /var/pro/; #change this with the right location
index index.php index.html index.htm;
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
try_files $uri $uri/ /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php7.0-fpm.sock; #be careful for the php version you are using
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment