Looking for a tut for installing nginx mariadb and php on ubuntu 20.04

Posted September 2, 2020 1.9k views
NginxPHPDrupalMariaDBUbuntu 20.04

Hey community…!
I tried this:
No joy.
I followed carefuly the instructions and after creating the index.html file it doesn’t appears in my browser.
But I what I really want is to install nginx mariadb and php on ubuntu 20.04 for Drupal 8 and 9 websites.
Can somebody point me in the right direction..?

Warm regards from way too sunny México.

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.

Submit an Answer
3 answers

Hey José,

It appears there is some misconfiguration in Nginx configuration. I would recommend you to double-check the configuration by the following Step 4:

If you can share the URL and error message it would be easier to provide some suggestions. Also, you can open a support ticket to DigitalOcean for help.



by Erika Heidi
The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications written in PHP. This is an acronym that describes a Linux operating system, with an Nginx (pronounced like “Engine-X”) web server. The backend data is stored in a MySQL database, and dynamic processing is handled by PHP. In this guide, we'll set up a LEMP stack on an Ubuntu 20.04 server.
  • I appreciate your troublesm Dikshith.

    I just repeated the installation, NginX down to PHP. No error message at all.

    The NginX welcome message is still there. And if I add /index.html to the url it throws me a big fat 404 Not Found message.

    The url is

    • Hey,

      It looks like you don’t have your index.html file in correct location. The root value defined in nginx config will decide the document root for your website. If yyou are following the tutorial then the root should look something like below in /etc/nginx/sites-available/ file:

      root /var/www/;

      So, please make sure that index.html file is present in this folder /var/www/



      • Hey there!
        Yep. Everything is in place, just as you described.

        What about ownership…?
        /etc/nginx/sites-available/ file is root:root with 644 permissions.

        While /var/www/ directory is jose:jose, 755;
        and /var/www/ file is again jose:jose, 664

        Thankful regards


        You said:
        *like below in /etc/nginx/sites-available/ file:

        root /var/www/*;

        Do you mean the directory named root…?

        • Hey,

          root is not a directory in that context. :)

          Yes, you can change ownership of /etc/nginx/sites-available/ file to jose:jose and check the functionality.

          Moreover, we do have nginx configuration tool which will help in generating the configuration file. I have customized it for you and here is the link.

          Customized Nginx configuration tool

          Let me know updating the configuration works for you!


          • @dikshith

            Still no joy.
            Changed ownership of /etc/nginx/sites-available/ to jose:jose
            In a browser still shows the NginX welcome message. If I go to I get a discouraging 404 message.

            Then I downloaded the config file you sent, uploaded it to /etc/nginx and extrated it right there.

            So I tried to restart nginx with this command: sudo service nginx restart
            Only to get the following:
            Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.

            Ran systemctl status nginx.service without sudo, and got this:
            nginx.service - A high performance web server and reverse proxy server
            Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
            Active: failed (Result: exit-code) since Thu 2020-09-03 14:17:31 UTC; 18min ago
            Docs: man:nginx(8)
            Process: 24229 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code-exited, status=1/FAILURE)

            Then ran sudo systemctl status nginx.service and got the exact same first lines plus the next:

            Starting A high performance web server and reverse proxy server…
            nginx: [emerg] cannot load certificate “/etc/letsencrypt/live/”: BIOnewfile() failed (SSL: error:02001002: system library:fopen:No such file or directory:fopen(’/etc/letsencrypt/live/
            nginx: configuration file /etc/enginx/enginx.conf test failed
            nginx.service: Control process exited, code=exited, status=1/FAILURE
            nginx.service: Failed with result ‘exit-code’.
            Failed to start A high performance web server and reverse proxy server.

            So I guess we’re getting somewhere…
            Warm regards.

Hi, @ppdigital59

Could you please let me know if you’ve also completed all the steps from the Prerequisites section - as well?

If you try to load the index file in your browser do you get any error messages or the page is just not loading?


by Brian Boucheron
When you first create a new Ubuntu 20.04 server, you should perform some important configuration steps as part of the basic setup. These steps will increase the security and usability of your server, and will give you a solid foundation for subsequent actions. In this tutorial you will create a user, give them sudo access, and set up a firewall.

According to a comment in the very same tutorial I used,, after this step:
sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
You absolutly have to run this:
sudo unlink /etc/nginx/sites-enabled/default

So now it’s working.

The tutorial should be updated.