- Create site:
ee site create DOMAIN.TLD --wp --php7
- Create usergroup
sudo groupadd DOMAIN
- Create user
sudo useradd -d /var/www/DOMAIN.TLD/htdocs -g DOMAIN DOMAIN
- Create php-fpm config
vi /etc/php/7.0/fpm/pool.d/DOMAIN.conf
[DOMAIN]
user = DOMAIN
group = DOMAIN
listen = /var/run/php7-fpm-DOMAIN.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
ping.path = /php-fpm/ping
pm.status_path = /php-fpm/status
- restart php-fpm
service php7.0-fpm restart
- Check if user is part of the pool:
ps aux|grep php-fpm
- Edit Nginx config
vi /etc/nginx/sites-enabled/DOMAIN.TLD
:
##wordpress.conf
server {
server_name DOMAIN.TLD www.DOMAIN.TLD;
location ~ ^/php-fpm/(status|ping)$ {
access_log off;
allow 127.0.0.1;
#deny all;
fastcgi_pass unix:/var/run/php7-fpm-DOMAIN.sock;
include fastcgi_params;
}
access_log /var/log/nginx/DOMAIN.TLD.access.log rt_cache;
error_log /var/log/nginx/DOMAIN.TLD.error.log;
root /var/www/DOMAIN.TLD/htdocs;
index index.php index.html index.htm;
# include common/php7.conf;
### Copy from here ###
include common/wp-secure.conf;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php7-fpm-DOMAIN.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
### Copy to here ###
include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/DOMAIN.TLD/conf/nginx/*.conf;
}
- Reload Nginx config
service nginx restart