Config from sites-avalible
server { charset utf-8; client_max_body_size 128M; listen 80; server_name yii2-lessons.local; root /home/stepan/Yii2_GB_course/yii2_lessons/web; index index.php; access_log /home/stepan/Yii2_GB_course/yii2_lessons/log/access.log; error_log /home/stepan/Yii2_GB_course/yii2_lessons/log/error.log; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { try_files $uri =404; } error_page 404 /404.html; location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/run/php/php7.0-fpm.sock; try_files $uri =404; } location ~* /\. { deny all; } } Config /etc/php/7.0/fpm/pool.d
[www] user = www-data group = www-data listen = /run/php/php7.0-fpm.sock listen.owner = www-data listen.group = www-data pm = dynamic pm.max_children = 5 pm.min_spare_servers = 1 pm.max_spare_servers = 3