LEMP = Linux Engine-X (nginx) MySQL PHP.
Настройка выполняется на хосте web.
apt-get install nginx
mkdir /var/www/web
nano /etc/nginx/sites-available/web.lab.lan
server {
listen 80;
root /var/www/web;
index index.php index.html index.htm;
server_name web.lab.lan;
location / {
try_files $uri $uri/ =404;
}
}
ln -s /etc/nginx/sites-available/web.lab.lan /etc/nginx/sites-enabled/web.lab.lan
nginx -t
systemctl restart nginx
mysql
и установите его.mysql
и задайте пароль для mysql-пользователя root.mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'specialist';
mysql> quit;
mysql_secure_installation
apt install php-fpm php-mysql
find / -name *fpm.sock
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:<путь к сокету php-fpm>;
}
<?php
phpinfo();
?>
wget https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress/* /var/www/web/
chown -R www-data:root /var/www/
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename) {
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
mysql -uroot -p
mysql> CREATE DATABASE wordpress;
mysql> quit;
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/web.key -out /etc/ssl/certs/web.crt
listen 443 ssl;
...
ssl_certificate /etc/ssl/certs/web.crt;
ssl_certificate_key /etc/ssl/private/web.key;
server {
listen 80;
server_name web.lab.lan;
return 301 https://web.lab.lan;
}