PHP webpage downloads instead of opens in browser (nginx, php on debian10 server)
I have a server running Debian 10. I have installed nginx (1.18.0) and php and php-fpm (7.4.28). Following this guide I was able to get html website with certification by certbot running. Then I wanted to use php to have menu on my website dynamic. When I go to the webpage it downloads instead of opening up.
My file tree is as follows: my webpage is stored in /var/www/dragallur, there is a file phpinfo.php with the following code (if I type it asks me to download the webpage):
<?php phpinfo(); ?>In the directory /etc/nginx/sites-available there are two files, default and mywebsite, default has following contents:
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.php index.html; server_name _; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } location ~ /.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;}}And the file mywebsite:
server { server_name dragallur.xyz ; root /var/www/dragallur ; index index.php index.html index.htm index.nginx-debian.html ; location / { try_files $uri $uri/ =404 ; #try_files $uri $uri/ /index.php?q=$uri&$args; } location ~ /.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; }
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/ # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot}
server {
if ($host = dragallur.xyz) { return 301
} # managed by Certbot listen 80 ; listen [::]:80 ; server_name dragallur.xyz ;
return 404; # managed by Certbot}This issue seems to happen quite often to people. I have tried cleaning my cache, I have done countless changes to the two files above but I still get the same problem. There may be other key config files so just tell me and I will share the contents. After every change which I think might be useful I run the command
systemctl restart nginx 7 Reset to default Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"