Як встановити на Ubuntu Nginx, MySQL, PHP (LEMP Stack) + WP


sudo service apache2 stop
sudo apt-get remove apache2
sudo apt-get autoremove

sudo apt-get update
sudo apt-get install nginx

sudo apt-get install mysql-server
sudo mysql_secure_installation

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

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.



For local inslalations change users to you


user = eugen
group = eugen

listen.owner = eugen
listen.group = eugen


Install Nginx, MySQL, PHP (LEMP) stack on Ubuntu 16.04

1 комментарий

  1. to change max upload size for nginx + php

    nano /etc/php5/fpm/php.ini

    upload_max_filesize = 100M
    post_max_size = 100M

    Also add following line to http{..} block in nginx config:

    http {
    client_max_body_size 100m;

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *