Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smknbangil1/a31502de604d4d9722a7e7eeaffff3dd to your computer and use it in GitHub Desktop.
Save smknbangil1/a31502de604d4d9722a7e7eeaffff3dd 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