Question

"Welcome to Nginx!" After following Ubuntu 18.04 Wordpress Installation guide

Posted May 8, 2020 527 views
NginxWordPressUbuntu 18.04

I have a droplet running Ubuntu 18.04.

I followed this guide (https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04)

I made sure to complete all the prerequisite steps, ensuring that I didn’t make any typos and followed every step.

Everything seemed to go smoothly until the absolute last step where you log in to Wordpress via the domain. Rather than getting the wordpress login, I’m still getting the “Welcome to Nginx” text page.

I’ve tried searching and some people say this is due to the index.html file, but I don’t even know where to begin to find the source of the issue.

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.

×
2 answers

Hi there @ic891,

There are a few things which could be causing this:

  • If you used the configuration file at /etc/nginx/sites-enabled/default then you just need to run this command in order to delete the index file:
  • sudo rm /var/www/html/index.html

This would delete the default Nginx index file.

  • If you created a new server block, you need to make sure that the configuration file has a symlink from your sites-available folder to your sites-enabled folder, to check that run this command here:
  • sudo ls -l /etc/nginx/sites-enabled/

If you do not see your new server block in there, you can run this command here:

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/

After run a config test:

  • sudo nginx -t

If no errors were reported, reload Nginx by typing:

  • sudo systemctl reload nginx

You need to make sure that Nginx can access your WordPress files, to do that you need to run this command:

  • sudo chown -R www-data:www-data /var/www/wordpress

Let me know how it goes!

If this still does not help please run the following commands and share the output here:

  • sudo ls -l /etc/nginx/sites-enabled/

Then run:

  • sudo /etc/nginx/sites-enabled/ -print -exec cat {} \;

Hope that this helps!
Regards,
Bobby

Hi @ic891,

I am sure you made an error while doing configuration, Follow this carefully to solve this.

First Unlink the default Nginx configuration, if you not done yet.

sudo unlink /etc/nginx/sites-enabled/default

Next, create a configuration file for your website:

sudo nano /etc/nginx/sites-available/domain.com

Add the following configuration:

server {
        listen 80;
        root /var/www/public_html;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name yourdomain.com;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }
}

Enable configuration for a new website:

sudo ln -s /etc/nginx/sites-available /etc/nginx/sites-enabled

sudo systecmctl reload nginx

Once you have done this, Install PHP-fpm to process the PHP files, Nginx will not process the PHP files.

sudo apt install PHP-fpm

Install WordPress in your public_html directory and then you can use your website.

If you still have any problem, Let me know.

Submit an Answer