Skip to content

Instantly share code, notes, and snippets.

@arifsetyawan
Created November 27, 2012 15:45
Show Gist options
  • Save arifsetyawan/4154950 to your computer and use it in GitHub Desktop.
Save arifsetyawan/4154950 to your computer and use it in GitHub Desktop.
Nginx configuration file for PHP-FPM and fuel-php
master_process on;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
worker_priority 0;
worker_rlimit_nofile 8192;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
multi_accept off;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 0;
## General Options
charset utf-8;
source_charset utf-8;
ignore_invalid_headers on;
server_name_in_redirect off;
## TCP options
tcp_nodelay off;
tcp_nopush on;
server {
listen 8080;
server_name localto-dev.fr;
root /var/www; # whatever is yours
index index.php index.html index.htm;
location / {
try_files $uri $uri/ @handler;
expires 30d;
}
location @handler {
rewrite ^ /index.php?/$request_uri;
}
location ~ ^/index.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.php$ {
deny all;
}
location ~* ^/(modules|application|system) {
return 403;
}
error_page 404 /index.php;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment