php8已经默认自带php-fpm
安装好nginx 和php8后
cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
这个配置文件中设置了php-fpm通过tcp9000进行通讯
nginx配置文件,index.php隐藏了路径
server {
listen 80;
server_name ;#域名
root /usr/local/apache2/htdocs/laravel11nginx/public;
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
# try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000; # PHP-FPM 监听的地址和端口
}
}
重启phpfpm
sudo /usr/local/php8/sbin/php-fpm -R
未经允许不得转载:lxfamn » nginx+php8