Manus Gallagher
Manus Gallagher

Reputation: 1043

NGinx Server Issue

So I am using a Digital Ocean Server and I sued the LEMP build.

When I navigate to the /var/www/html directory, I see the two standard files that come with the build 'index.html' and 'index.php'.

Now my issue is, my Web App is Structured in such a way that the "index.html" file is located down another subdirectory "dist". (/var/www/html/dist/)

How do I configure Nginx to show this file?

Update:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/html;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    servername ***.**.**.**;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

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

Upvotes: 1

Views: 202

Answers (1)

Hugo David Farji
Hugo David Farji

Reputation: 174

Change this line in your configuration

    root /var/www/html;

and put this one

    root /var/www/html/dist;

EDIT:

And if you use a Debian based server (Ubuntu for example), do sudo service nginx reload on your console. If it doesn't work try sudo service nginx restart

Upvotes: 2

Related Questions