Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

Ngrok not tunneling properly Nginx

In my Nginx, I have my flex application built over my VM. Deployment is also done and anyone can access my APIs since I have made is public.

But when I run the Nginx, I am not able to open it without using the Http link since I don't have a domain name to generate the SSL certificate.

So when I Run Ngrok it is leading to the web page of Nginx home page instead of my webpage

Why is this happening?

Even when I run the "curl localhost" I am getting the Ngnix page. when I use the "curl-4 localhost" I am getting my web app home page

server {

    listen 80;

    server_name 0.0.0.0;

    location / {

        include proxy_params;

        proxy_pass http://unix:/home/datascience/chatbot-cima/chatbot.sock;

    }

}

server {

    listen 80;

    server_name 127.0.0.1;

    location / {

        proxy_pass http://unix:/home/datascience/chatbot-cima/chatbot.sock;

    }

}

server {

    listen 80;

    server_name localhost;

    location / {

        proxy_pass http://unix:/home/datascience/chatbot-cima/chatbot.sock;

    }

}

server {

    listen 80;

    server_name public.ip;

    location / {

        proxy_pass http://unix:/home/datascience/chatbot-cima/chatbot.sock;

    }

}

1 Answer

0 votes
by (36.8k points)

As per my knowledge request which comes from the Ngrok will be having the Host head set to Ngrok URL. When the Ngrok receives the URl it tries to match one of the servers and blocks in the configuration if there is no server name found.

I think there is another configuration file 

/etc/nginx/conf.d/default.conf or /etc/nginx/sites-enabled/0-default

which consist of list of directives with default server set. those server set will catch the request sent by you and serve the welcome page of nginx.

So you need to search that file and remove it. This will solve your issue.

 you can also simplify your configuration by using the below code:

server {

    listen 80;

    server_name localhost;

    location / {

        include proxy_params;

        proxy_pass http://unix:/home/datascience/chatbot-cima/chatbot.sock;

    }

}

In case if there is any server which is blocking the URL then this

 listen 80 default_Server;

will help you to catch the request.

If you want to know more about the Data Science then do check out the following Data Science tutorial link which will help you in understanding Data Science from scratch

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 31, 2019 in Data Science by sourav (17.6k points)
0 votes
1 answer
asked Jan 21, 2021 in BI by Chris (11.1k points)

Browse Categories

...