I'm trying to reach my index.php file on localhost / other-40.umwelt-campus.de but instead of calling the page it's downloading an empty file.. Even if I downloaded php fpm and configured it.
The file is at: /var/www/html/MyDigitalHome/index.php
Parts of the config file look like:
root /var/www/html/;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
# proxy_pass http://localhost:8080;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.3-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.3-fpm:
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
The php file just looks like:
<!-- Redirect to MyDigitalHome mainpage-->
<?php
header('Location: /MyDigitalHome/src/services/overview.php');
exit;
Your redirection is broken. You must redirect over HTTP, but instead you point to local file, which means it is a) available only to people having access to that file system (usually just you), b) being accessed by web browser directly so no matter how good your nginx config is it will not matter as server is not involved in file access (it can be even down and you will get that file if you have filesystem access).