Problems installing Nginx on Ubuntu 18.04

Posted February 28, 2020 3.1k views

Is seems that I having issues with the step 5. The server fails to restart after sudo nginx -t .

I tried reinstalling NGINX without completing “Step 5 – Setting Up Server Blocks (Recommended)”. I just copy pass my entire web server files in the HTML directory and it works just fine. Is Step 5 really necessary? Is their a better way than Step 5 because obviously this step is buggy and untested?

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
2 answers

Hello, @SephiaSky

I’ve followed the tutorial on a fresh droplet and everything went all good without any issues. Do you get any syntax errors when you check the Nginx configuration using the command you’ve mentioned:

sudo nginx -t

You can skip the part with the creation of the site’s files, e.g the HTML file for the index page and go and setup directly the server block:


server {
        listen 80;
        listen [::]:80;

        root /var/www/;
        index index.html index.htm index.nginx-debian.html;


        location / {
                try_files $uri $uri/ =404;

then enable the file by creating the symlink

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

and then tweaking the nginx config file:


Let me know if you have any questions.


Show answer This answer has been marked as resolved by SephiaSky.