Last active
February 17, 2018 19:58
-
-
Save arupgsh/e50f4cd05547f0334412 to your computer and use it in GitHub Desktop.
Nginx server configuration for running a CodeIgniter based site with PHP-FPM. https://www.wptron.com/configure-nginx-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
#Author: Arup Ghosh | |
#Description: https://gist.github.com/arupgsh/e50f4cd05547f0334412 | |
#2016 | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
server_name example.com www.example.com; | |
root /var/www/example.com/public_html/; | |
index index.php; | |
error_log /var/www/example.com/error.log; | |
# set expiration of assets to MAX for caching | |
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { | |
expires max; | |
log_not_found off; | |
} | |
# main codeigniter rewrite rule | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
# php parsing | |
location ~ .php$ { | |
root /var/www/example.com/public_html/; | |
try_files $uri =404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 256 4k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment