Report this

What is the reason for this report?

Wordpress droplet downloads file rather than serving

Posted on June 2, 2020

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;
        #}

        
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.