修改 nginx 配置文件
vim /etc/nginx/nginx.conf
在 server 中插入如下代码:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
###Save user landing page to cookie: srcid for PHP files
##add_header Set-Cookie $srcid;
}
使用如下站点配置指令就可以支持 URL 美化:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
修改 php-fpm 配置文件
#vim /etc/opt/remi/php74/php-fpm.d/www.conf
vim /etc/opt/remi/php74/php-fpm.conf
#/var/opt/remi/php74/run/php-fpm/php-fpm.sock
找到以下三行代码并修改如下:
user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nignx
listen.group = nginx
listen.mode = 0660
修改 php.ini
vim /etc/opt/remi/php74/php.ini
4.重启php-fpm
systemctl start php74-php-fpm
systemctl restart php-fpm nginx
systemctl status php-fpm
来源地址:https://blog.csdn.net/windwenguan/article/details/122318408