nginx redirects all requests to root

_lukman_ nginx-forum at forum.nginx.org
Mon Jun 20 21:23:23 UTC 2022


Hello Everyone.

My first post as I am new to this forum, as well as nginx.
I have an ecu instance where I host my files. I have a landing page placed
in root and an admin area placed in /app folder. However, all requests
somehow redirect to the root. My script is below. I dont know what I am
doing wrong.

server
{
   listen 443 default_server ssl;
   listen [::]:443 ssl http2;
   server_name dummysite.io www.dummysite.io;
   ssl_certificate /etc/letsencrypt/live/dummysite.io/fullchain.pem; #
managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/dummysite.io/privkey.pem; #
managed by Certbot
   location /
   {
      root
/home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
      index index.html index.php;
      # try_files $uri /index.html index.php;
   }

    error_log /var/log/nginx/dummysite.log;
    access_log /var/log/nginx/dummysite.log;
}



server
{

    listen  80;
    server_name dummysite.io www.dummysite.io;
    return 301 https://dummysite.io$request_uri;
    charset utf-8;
    root 
/home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
    index  index.html index.htm index.php;
    # Always serve index.html for any request
    location /
    {
        root
/home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
        # try_files $uri = index.html index.php;
    }
    return 301 https://dummysite.io$request_uri; # managed by Certbot
    error_log  /var/log/nginx/vue-app-error.log;
    access_log /var/log/nginx/vue-app-access.log;
}

thank you in advance

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294531,294531#msg-294531



More information about the nginx mailing list