Loading...
 

This is a how-to implement php-fpm and Nginx

1. PHP-FPM

/etc/php5/fpm/pool.d/tiki.conf
Copy to clipboard
; Start a new pool named 'web'. ; the variable $pool can we used in any directive and will be replaced by the ; pool name ('web' here) [web] user = www-data group = www-data listen = 127.0.0.1:9001 listen.owner = www-data listen.group = www-data listen.mode = 0666 listen.allowed_clients = 127.0.0.1 pm = dynamic pm.max_children = 10 pm.start_servers = 4 pm.min_spare_servers = 2 pm.max_spare_servers = 6 pm.process_idle_timeout = 10s; ;pm.max_requests = 500 pm.status_path = /status ping.path = /ping ping.response = pong access.log = /var/log/$pool.access.log access.format = %R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%% slowlog = log/$pool.log.slow request_slowlog_timeout = 10 ;request_terminate_timeout = 0 ;rlimit_files = 1024 ;rlimit_core = 0 ;chroot = chdir = / security.limit_extensions = .php .php3 .php4 .php5 php_flag[display_errors] = on php_flag[html_errors] = on php_admin_value[error_log] = /var/log/fpm-php.www.log php_admin_flag[log_errors] = on php_admin_value[memory_limit] = 512M php_admin_value[date.timezone] = 'Europe/Paris'

2. Nginx

/etc/nginx/sites-available/tiki.local
Copy to clipboard
server { #listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 root /home/myuser/tikitrunk; index index.html index.php; server_name tiki.local; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: fastcgi_pass 127.0.0.1:9001; # With php5-fpm: #fastcgi_pass unix:/var/run/web.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }

List Slides