NGINX downloads PHP files insted of executing

nginxPHP

I tried everything and searched everywhere.

I'm following this guide: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04

My config file:

server {
listen 80;
server_name your_domain www.your_domain;
root /var/www/your_domain;

index index.html index.htm index.php;

location / {
    try_files $uri $uri/ =404;
}

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
 }

location ~ /\.ht {
    deny all;
}

}

I created a info.php file.
When I visit mydomain.com/info.php it download the file instead of executing it.
Already cleared browser cache, also in NGINX.

Best Answer

Solved by myself. Here is the solution:

I double checked the configuration file uploaded to my server and I found that 2 tilde were missing after the "location" config. I just added them and everything is working