LEMPインストール
サーバのインストール後にsshを使用してlempをインストール
register repository and install mariadb
user@localhost = only allow access from localhost (connecting from localhost only)
Install nginx and php
apt-list nginx
apt install nginx
nginx -v //check nginx version
service nginx status //check nginx service status
apt list php7.4-fpm
apt install php7.4-fpm php7.4-gd php7.4-json php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl php-imagick php7.4-xml php7.4-zip, php7.4-opcache
allow php7.4 to start automatically when rebootsystemctl enable php7.4-fpm
systemctl start php7.4-fpm
service php7.4-fpm status
check php statusmkdir -p /var/www/html
nano /var/www/html/index.php
add this code to index.php<?php
phpinfo();
?>
change default server setting to read a php file from nginxrm -rf /etc/nginx/sites-available/default //remove default server setting file
nano /etc/nginx/sites-available/default //create a new setting file
copy and paste this codesserver {
listen 80 ;
listen [::]:80 ;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
access_log /var/log/nginx/web.access.log;
error_log /var/log/nginx/web.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_cache off;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include mime.types;
}
location ~ /\.ht {
deny all;
}
}
save the above file and restart nginxservice nginx restart
Install MariaDB
register repository and install mariadb
sudo apt-get install software-properties-common dirmngr apt-transport-https
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/10.5/ubuntu focal main'
sudo apt update
sudo apt install mariadb-server
lemp installation completeCreate DB and user
sudo mysql //start maria db
create database abcd; //create db
//create a user
create user 'userName'@'%' identified by 'password';
//change user account password
alter user 'userName'@'%' identified by 'newPassword';
//gran privileges to db and reload
grant all privileges on abcd.* to userName@'%';
flush privileges;
user@% = allow access from all locations (connecting from any host)user@localhost = only allow access from localhost (connecting from localhost only)
Reference
この問題について(LEMPインストール), 我々は、より多くの情報をここで見つけました https://velog.io/@yooj/LEMP-설치テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol