Question
Wordpress droplet downloads file rather than serving
Hi,
I need to migrate my website from old server to Digital Ocean.I stopped the apache2 server and installed nginx on the Wordpress droplet. On restarting the Nginx server and hitting the IP in the browser, I get a prompt to download the index.php file rather than the loading the WP website.
Upon searching the web, one of the solutions was to delete the .htaccess file. However, that file is missing from the /var/www/html directory.
What am I missing. Stuck on this for too long without any progress.
Below is my Nginx server block:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.php =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×