So, I'm posting an answer, because after the twice clean-reinstall, I have set things a but differently (to my point of view).
Like I said above, I face a dilemma, since none of the config I have is the same as to any other answers I could find.
For instance :
My /etc/nginx folder is basically constituted as followed :
|- /etc/nginx/
| |- conf.d/
| | |- default.conf
| |
| |- fastcgi_params
| |- mime.types
| |- modules/ -> /usr/lib/nginx/modules
| |- nginx.conf
| |- scgi_params
| |- uwsgi_params
There is no /sites-available or /sites-enabled as seen everywhere, the mentioned fastcgi-php.conf is actually a fastcgi_params in the root folder, my default hence is not in the site-available folder.
Here are the two configs files I now have (domain hidden under my_domain.com):
First : the nginx.conf (almost untouched)
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
include /etc/nginx/sites-available/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
Secondly the /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name my_domain.com www.my_domain.com;
location / {
root /var/www/www.my_domain.com;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/www.my_domain.com;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
#if (!-f $document_root$fastcgi_script_name) {
# return 404;
#}
root /var/www/www.my_domain.com;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
I also added a line
text/php php;
to the mime.types
I also remember to delete the cache of my_domain in the browsers I use (Firefox, Opera and Chrome).
But still, the file is downloaded.
What did I do wrong ?
Edit : as I would like to make a blog.my_domain.com, shop.my_domain.com and forum._mydomain.com, I created the /site-available and /site-enabled folder, intend to create a blog/forum/shop.my_domain.com.conf in each folder of the same name located in the /sites-available, but I'm awaiting for a working config to make them visible in the nginx.conf (with an include line, right ?).
So I don't really get how these two folders work. The subdomains have their CNAME record set to my_domain.com.
I also read about making a symlink for these sub-websites, but I don't really know from where to where ?
Thanks again
The error log tells me the connection to /var/run/php/ is denied. the default user is www-data www-data, but my defaut nginx user is nginx (if I change it, it doens't even start.)
Should I make a
chown nginx:nginx /var/run/php/
?