Skip to content

Instantly share code, notes, and snippets.

Avatar

André Assis andretefras

View GitHub Profile
@andretefras
andretefras / php-pools.md
Created Apr 29, 2020 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)
View php-pools.md

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@andretefras
andretefras / nginx.conf
Created Mar 22, 2020 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
View nginx.conf
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@andretefras
andretefras / pagination.ctp
Created Oct 25, 2016
CakePHP - Pagination element
View pagination.ctp
<ul class="pagination">
<?php
echo $this->Paginator->prev('«', array('tag' => 'li'), null, array('class' => 'disabled', 'tag' => 'li', 'disabledTag' => 'a'));
echo $this->Paginator->numbers(array('separator' => '', 'currentTag' => 'a', 'tag' => 'li', 'currentClass' => 'disabled'));
echo $this->Paginator->next('»', array('tag' => 'li'), null, array('class' => 'disabled', 'tag' => 'li', 'disabledTag' => 'a'));
?>
</ul>
@andretefras
andretefras / .htaccess
Last active Sep 23, 2017
WordPress - Pointing to remote uploads folder
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) http://domain.com/wp-content/uploads/$1 [L,P]
</IfModule>