Skip to content

Instantly share code, notes, and snippets.

@cse031sust02
Created June 16, 2015 10:55
Show Gist options
  • Save cse031sust02/2d8a6c13fb85a76a28b2 to your computer and use it in GitHub Desktop.
Save cse031sust02/2d8a6c13fb85a76a28b2 to your computer and use it in GitHub Desktop.
Nginx Server for CodeIgniter
server {
server_name domain.tld;
root /var/www/codeignitor;
index index.html index.php;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
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 =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
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