Forked from janmejai/NGINX Rewrite rules for CodeIgniter
Created
October 31, 2022 23:30
-
-
Save smknbangil1/a31502de604d4d9722a7e7eeaffff3dd to your computer and use it in GitHub Desktop.
NGINX Rewrite rules for CodeIgniter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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