Welcome! Log In Create A New Profile

Advanced

NGINX with PHP

Posted by Imre84 
NGINX with PHP
February 25, 2022 11:53AM
Hello!

I recently installed 64 bit Bullseye to Pi4 4GB model without GUI. I am trying to setup some websites (for example nextcloud), and installed NGINX with PHP 8.1. I modified a bit the PHP config based on nextcloud install description, so maybe I can give a try with default config, but should not be the problem here I think.

PHP works fine with this config:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}

But the php files are only downloaded with this config:
upstream php-handler {
server unix:/var/run/php/php8.1-fpm.sock;
}
At first I tried the default available 7.4 PHP version, but got the same result.
I also checked different descriptions, but I couldn't figure out what the problem is with.

For now I am trying this with very simple server blocks to make the above work.
server {
listen 80;
listen [::]:80;
root /var/www;
index index.php index.html index.htm;
server_name example.com;
}

The config with upstream would be better with more server blocks I think, I would like figure out how to make it work. Any suggestions would be much appreciated.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 171
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready