優化Ubuntu上的PHP加載速度可從以下方面入手:
sudo apt install php-opcache
。php.ini
:設置opcache.enable=1
、opcache.memory_consumption=128
等參數,重啟PHP-FPM生效。pm.max_children
、pm.start_servers
等參數,優化進程管理。KeepAlive
,調整MaxClients
等參數。worker_processes
、fastcgi_pass
配置。具體操作前建議備份配置文件,根據服務器資源調整參數。