Nginx
sudo service apache2 stop
sudo apt-get remove apache2
sudo apt-get autoremove
sudo apt-get update
sudo apt-get install nginx
MySQL
sudo apt-get install mysql-server
sudo mysql_secure_installation
PHP
sudo apt-get install php-fpm php-mysql
sudo apt-get install php7.1-gd
Configure the PHP Processor
sudo nano /etc/php/7.1/fpm/php.ini
—cgi.fix_pathinfo=0
server { server_name ~^(www\.)?(?<sname>.+?)$; root /home/eugen/www/$sname/www; index index.php; # WORDPRESS : Rewrite rules, sends everything through index.php and keeps the appended query string intact location / { try_files $uri $uri/ /index.php?q=$uri&$args; } # SECURITY : Deny all attempts to access PHP Files in the uploads directory location ~* /(?:uploads|files)/.*\.php$ { deny all; } # REQUIREMENTS : Enable PHP Support location ~ \.php$ { # SECURITY : Zero day Exploit Protection try_files $uri =404; # ENABLE : Enable PHP, listen fpm sock fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # PLUGINS : Enable Rewrite Rules for Yoast SEO SiteMap rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; #Yeah! you did it. #https://www.digitalocean.com/community/tutorials/how-to-configure-single-and-multiple-wordpress-site-settings-with-nginx }
For local inslalations change users to you
/etc/php/7.0/fpm/pool.d/www.conf
user = eugen group = eugen listen.owner = eugen listen.group = eugen
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04