0

I am using Nginx for my web server, but when I go to a PHP page it downloads it to me.
I realized that my pterodactyl panel (which is in php) was still working, so I used the fastcgi and other parts of its config, without this changing my problem
I have Nginx last version and PHP 8.0 installed on a Debian 11 VPS.
The files are under permission 775 and owned by the group www-data. The logs aren't giving me any reason for this problem.

server {
    listen 80;
    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html/site;
    index index.html index.php index.htm index.nginx-debian.html;
    server_name mondomaine.eu www.mondomaine.eu;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}

Can you help please? Thanks

coera
  • 1
  • Is your domain `mondomaine.eu`? – Paul Dec 05 '21 at 19:12
  • verify with https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ more over verify that the socket exists and the daemon running from php fpm, i am unsure but wasnt it /var/run instead /run? – djdomi Dec 05 '21 at 20:59
  • @djdomi Depending on the OS, `/var/run` may be symlinked to `/run`. – Paul Dec 06 '21 at 16:01
  • Hey! Well, I just edited the domain, it's not that one in reality and DNS are working. Then, the path to PHP FPM works, but when trying to access /run/php/php8.0-fpm.sock, I have a permission denied error even though the permission is 775. – coera Dec 08 '21 at 17:36
  • The ownership and permissions of `php8.0-fpm.sock` should be `www-data:www-data` usually with `660` permissions. – Paul Dec 08 '21 at 18:33

0 Answers0