在Debian上升級LNMP(Linux, Nginx, MySQL/MariaDB, PHP)環境涉及多個步驟,包括更新系統、升級軟件包以及重新配置相關服務。以下是詳細的升級步驟:
sudo apt update
sudo apt upgrade
sudo apt autoremove
sudo apt clean
nginx -v
sudo apt install nginx
sudo systemctl restart nginx
mysql --version
sudo apt install mariadb-server mariadb-client
sudo mysql_secure_installation
sudo systemctl restart mariadb
php -v
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2 # 如果你使用的是Apache
sudo systemctl restart php7.x-fpm # 如果你使用的是PHP-FPM
sudo vim /etc/nginx/sites-available/default
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.x-fpm.sock; # 修改為你的PHP-FPM套接字路徑
}
sudo nginx -t
sudo systemctl restart nginx
通過以上步驟,你應該能夠在Debian上成功升級LNMP環境。如果在升級過程中遇到問題,建議查看相關服務的日志文件以獲取更多信息。