LNMP是指Linux系统下Nginx+MySQL+PHP这种网站服务器架构,以下是LNMP在Debian上的安装步骤:
sudo apt update
sudo apt install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
sudo apt install mariadb-server mariadb-client
sudo mysql_secure_installation
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo systemctl status mariadb
sudo apt install php php-fpm php-mysql
sudo systemctl start php7.4-fpm
sudo systemctl enable php7.4-fpm
sudo systemctl status php7.4-fpm
sudo vim /etc/nginx/sites-available/default
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
sudo nginx -t
sudo systemctl restart nginx
至此,LNMP环境已经在Debian上成功安装并配置完成。