So I have a domain setup with this nginx config:
server {
root /var/www/reallyuhc.com/html;
index index.php;
server_name reallyuhc.com www.reallyuhc.com;
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/reallyuhc.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/reallyuhc.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
if ($host = www.reallyuhc.com) {
return 301 https://$host$request_uri;
}
if ($host = reallyuhc.com) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name reallyuhc.com www.reallyuhc.com;
return 404;
}
Now the issue is that if I do domain.com/index
, I see the index file, but doing domain.com
will just download that file.
What is missing here? It's all working fine, only the / downloads the file instead of showing the index file. Is this something related to Wordpress? Wordpress is installed for that domain.
question from:
https://stackoverflow.com/questions/66050059/nginx-downloads-file-instead-of-redirecting 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…