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

Install_LEMP-twitter

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

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

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

  1. to change max upload size for nginx + php

    Edit…
    nano /etc/php5/fpm/php.ini

    Set…
    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 не будет опубликован. Обязательные поля помечены *