I have a yii2 premium template application running on centos 9 with nginx and php 8.1. Set up the virtual host configuration as follows:
server { lis ten 80; server_name mydomain.com; root /home/lamtab/xp-app-main/app/appadmin/web; index index.php index.html index.htm index.nginx-debian.html; access_log "/var/log/nginx/mydomain.com.access.log"; error_log "/var/log/nginx/mydomain.com.error.log"; location / { try_files $uri /index.php$is_args$args; } location ~* .php$ { # With php-fpm unix sockets fastcgi_pass unix:/run/php-fpm/www.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; fastcgi_connect_timeout 90; fastcgi_send_timeout 90; fastcgi_read_timeout 90; }
Error log report for domain
FastCGI sends: "main script unknown" in stderr while reading response headers from upstream..."
And nginx error log report
index.php" failed (13: Permission denied)
Any clues?
In my case, I wasted a few hours in vain and ended up having to just restart the php8.1-fpm service in ubuntu 22.04. It might help to try it. My conf file looks like this