1、清理殘餘的舊版本
sudo apt-get remove nginx nginx-common nginx-full php php-fpm
2、安裝nginx PGP簽名文件
`wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key`
3、使用sudo修改source源
codename參數根據os來選擇:https://nginx.org/en/linux_packages.html#distributions
由於deepin20採用debian10.*的版本,所以codename參數即爲buster
sudo nano /etc/apt/sources.list.d/nginx.list
填入一下內容:
`deb http://nginx.org/packages/mainline/debian/ buster nginx
deb-src http://nginx.org/packages/mainline/debian/ buster nginx`
4、更新軟件源並安裝nginx和php-fpm
`sudo apt-get update
sudo apt-get install nginx php-fpm`
5、查看nginx版本號
參考路徑 /etc/nginx/conf.d/default.conf
sudo nginx -v
6、修改php-fpm配置
參考路徑 /etc/php/7.3/fpm/pool.d/www.conf
`listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1`
7、修改nginx站點配置
`server { listen 80; server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm /_h5ai/public/index.php;
}
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}`
8、啓動php-fpm和nginx
`sudo systemctl start php7.3-fpm
sudo systemctl start nginx`
9、下載H5ai
https://release.larsjung.de/h5ai/h5ai-0.29.2.zip
附註:
Ubuntu徹底刪除PHP7.0
一、刪除php的相關包及配置
sudo apt-get autoremove php7*
二、刪除關聯
sudo find /etc -name "*php*" |xargs rm -rf
三、清除dept列表
sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
四、檢查是否卸載乾淨(無返回就是卸載完成)
dpkg -l | grep php7.0