2

I have deployed my node.js application on nginx server and it is up and running. I am able to access the application using the domain name that i bought. For example [www.myshopping.com] this is dummy name. When i am navigating to other URL through the application it is working. For example: www.myshopping.com/cart works fine for me through navigation link on the website.

But when i copy this URL(www.myshopping.com/cart) and paste into browser address bar it gives me 404 page not found

My nginx.conf file setting is as below

http {
       include       mime.types;
      default_type  application/octet-stream;


      server {
         listen       80;
         server_name  myshopping.com www.myshopping.com;
         root   /usr/share/nginx/build;
         index index.html index.htm;

         location / {

         }

       }
     } 

How to solve this problem of direct access to a particular URL. I am a newbie in nginx world

rak_6040
  • 65
  • 1
  • 1
  • 6
  • 2
    Try adding `try_files $uri $uri/ /index.html;` to your `location` block. – Richard Smith Apr 18 '20 at 09:15
  • Thank @RichardSmith its working now.. but the fallback is not working...it does not redirect to index.html for wrong URI but gives me blank page. Kindly suggest – rak_6040 Apr 20 '20 at 14:13

0 Answers0