Ubuntu Server Not serving the Web Page

oot@ubuntu-s-2vcpu-4gb-120gb-intel-lon1-01:~/Epos-F# sudo ls -l /root/Epos-F/build
total 516
-rwxr-xr-x 1 www-data www-data    447 May 20 09:05 asset-manifest.json
-rwxr-xr-x 1 www-data www-data 424159 May 20 09:03 cloud.png
-rw-r--r-- 1 www-data www-data    639 May 20 09:05 index.html
-rwxr-xr-x 1 www-data www-data  79838 May 20 09:03 logo.png
-rwxr-xr-x 1 www-data www-data    471 May 20 09:03 manifest.json
-rwxr-xr-x 1 www-data www-data     67 May 20 09:03 robots.tx

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
May 20, 2024
Accepted Answer

Hi there,

It’s not recommended to place your website’s content in the root directory (/root). Instead, it’s best practice to move it to the /var/www/html directory, which is the default directory for serving web content on many web servers, including Nginx.

  1. Move the Build Files: Move your build files from /root/Epos-F/build to /var/www/html/Epos-F. You can do this using the following commands:

    sudo mkdir -p /var/www/html/Epos-F
    sudo mv /root/Epos-F/build/* /var/www/html/Epos-F/
  2. Update Permissions: Ensure the files have the correct ownership and permissions. They should be owned by the www-data user and group:

    sudo chown -R www-data:www-data /var/www/html/Epos-F
    sudo chmod -R 755 /var/www/html/Epos-F
  3. Update Nginx Configuration: Edit your Nginx configuration to point to the new directory. Open your Nginx configuration file, which is usually found in /etc/nginx/sites-available/ or /etc/nginx/conf.d/. You can use a text editor like nano:

    sudo nano /etc/nginx/sites-available/default

    Update the root directive to point to the new location:

    server {
        listen 80;
        server_name your_domain_or_IP;
        root /var/www/html/Epos-F;
        index index.html;
        location / {
            try_files $uri $uri/ /index.html;
  4. Restart Nginx: After making these changes, restart the Nginx service to apply the new configuration:

    sudo systemctl restart nginx
  5. Check Nginx Status: Ensure that Nginx is running and has no configuration errors:

    sudo systemctl status nginx

If you encounter any errors, check the Nginx error log for more details:

sudo tail -f /var/log/nginx/error.log

Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel