Errot 404 Not Found nginx/1.18.0 (Ubuntu) DigitalOcean & Vultr

I have followed this article completely ( But after installing WordPress and visiting my domain I am facing this error. Please check the screenshot. (As iam new user I cannot upload image so i uploaded it in

Note: I have tried these steps on both Digital Ocean and Vultr and I got same error on both.

@aashish Please type below command in SSH Terminal. Let me know what log do you see.

tail -f /var/log/nginx/access.log

In that article, right now there are three versions of Server block, which one are you using?

  • General
  • Cache Enabler
  • FastCGI

0 voters

I am using FastCGI Server block.

Delete existing NGINX config from /etc/nginx-sites-available/ and /etc/nginx/sites-enabled/

Then, implement Cache Enabler Server block, see if it works.

1 Like

Can you please guide me step by step what to do? I am beginner so i am finding difficult. Please help!!!

First take a snapshot.

rm -f /etc/nginx/sites-available/* && rm -f /etc/nginx/sites-enabled/*
cd /etc/nginx/sites-available/

Paste below code using right click then press CTRL + O and Enter key to save.

# replace all with a domain like
server {
    listen         80;
    return 301 https://$host$request_uri;
server {
# Document Root
root /var/www/html;
index index.php index.html index.htm;
client_max_body_size 0;

    listen [::]:443 ssl http2 ipv6only=on;
    listen 443 ssl http2;
        ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;
        ssl_prefer_server_ciphers on;
        ssl_session_cache   shared:SSL:20m;
        ssl_session_timeout 20m;
        ssl_ciphers 'TLS13+AESGCM+AES128:EECDH+AES128';

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

# Rules for Cache Enabler Plugin - Static File Serving

    set $cache_uri $request_uri;

    # bypass cache if POST requests or URLs with a query string
    if ($request_method = POST) {
    set $cache_uri 'nullcache';

    if ($query_string != '') {
    set $cache_uri 'nullcache';

    # bypass cache if URLs containing the following strings
    if ($request_uri ~* '(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)') {
    set $cache_uri 'nullcache';

    # bypass cache if cookies contain the following strings
    if ($http_cookie ~* '(wp-postpass|wordpress_logged_in|comment_author)_') {
    set $cache_uri 'nullcache';

    # custom installation subdirectory
    set $custom_subdir '';

    # default HTML file
    set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}${scheme}-index.html';

    # WebP HTML file
    if ($http_accept ~* 'image/webp') {
    set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}${scheme}-index-webp.html';

    location / {
    gzip_static on; # this directive is not required but recommended
    try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;

location ~* \.php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
location = /favicon.ico {
log_not_found off;
access_log off;

location = /robots.txt {
log_not_found off;
access_log off;
allow all;

location ~* .(css|gif|svg|ico|jpeg|jpg|js|png)$ {
expires 1y;
log_not_found off;

# Enable Gzip compression.
gzip on;

# Disable Gzip on IE6.
gzip_disable "msie6";

# Allow proxies to cache both compressed and regular version of file.
# Avoids clients that don't support Gzip outputting gibberish.
gzip_vary on;

# Compress data, even when the client connects through a proxy.
gzip_proxied any;

# The level of compression to apply to files. A higher compression level increases
# CPU usage. Level 5 is a happy medium resulting in roughly 75% compression.
gzip_comp_level 5;

# Compress the following MIME types.

Create a Symlink

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


nginx -t

Restart NGINX web server.

service nginx restart
chown -R www-data:www-data /var/www/ && chmod -R 755 /var/www

Install & Activate Cache Enabler plugin

It worked!!! Sir I highly respect your support and work. I am feeling very happy after fixing this problem. Thanks for explaining in brief.

I was just about to ask - was my last reply helpful?
Glad to know it’s all set now. Let me know if you have any additional questions.

1 Like

While installing 2nd wordpress and running the following command certbot --nginx -d -d I am getting error.

Note - I have replaced with my domain name.

The above guide is intended only for single Installation.

For your error message fix, keep IP pointed before attempting to get new cert.

In the comment section of your article i found these steps.

Assuming, second site is

You need to follow steps this way.

  1. create a new directory and add WordPress (Ref: steps 31)

cd /var/www/
mkdir example2
tar -xvzf latest.tar.gz
mv -v wordpress/* /var/www/example2
rm -rf index.nginx-debian.html latest.tar.gz wordpress
chown -R www-data:www-data /var/www/
sudo chmod -R 755 /var/www

  1. Create a new Server block with root path located to new directory as created in step 1.

cd /etc/nginx/sites-available/
nano gulshankumar-org

server {
listen 80;
root /var/www/example2;
index index.php index.html index.htm;

  1. Point your domain to DNS, then install SSL

certbot --nginx -d -d

  1. Create new MySQL database
    sudo mysql -u root -p
    create database example2;
    grant all on example2.* to example2@localhost identified by ‘TYPE HERE PASSWORD’;
    flush privileges;

  2. Proceed to Installation by visiting your site

I am getting error on step 3. Also, i have already pointed the ip address 2 hours ago and i am using cloudflare.

I see you’re are using slightly different method to obtain SSL certificate which requires origin IP to be pointed for domain.

At the time of writing this response, it shows CF.

In Cloudflare DNS Menu > Switch from Proxy to DNS mode. Then you can proceed using above command.

I generally prefer Cloudflare DNS method for let’s encrypt as written in main Article.

Other best option is using Cloudflare Origin SSL certificate for user intended to use CF for proxy.

Ok got it. So i need to run this command -

certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini -d,* --preferred-challenges dns-01

  1. Create new MySQL database

    sudo mysql -u root -p
    create database example2;
    grant all on example2.* to example2@localhost identified by ‘TYPE HERE PASSWORD’;
    flush privileges;

  2. Proceed to Installation by visiting your site

Then follow the above steps. Right??

Yes, give a try.

done! But when i visit the instead of wordpress setup page the domain it is redirecting to main Any solution for this??

server_name directive can help.