Search code examples
pythonurlapkgoogle-colaboratoryngrok

How to make website available on google search using ngrok?


I tried to make my website offline and available on google search but I am using ngrok with is the url is variable and always change when run the program. how can I make the website url fixed by using ngrok coding? I need the fixed url because need to make an apk for mobile phone


Solution

  • You'd have to pay for ngrok's premium plans to get that functionality. If you already own a domain, you can easily achieve the same -

    Paste the following

    server {
      listen 80;
      listen [::]:80;
      listen 443;
      listen [::]:443;
      client_max_body_size 100M;
    
      server_name <your_domain.com>;
    
      location / {
        proxy_pass http://127.0.0.1:<your_port>;
      }
    
      proxy_redirect     off;
      # These are the critical headers needed by uvicorn to honor HTTPS in url_for :
      proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header   X-Forwarded-Proto $scheme;
     # These are just some other headers you may find useful
      proxy_set_header   Host $host;
      proxy_set_header   X-Real-IP $remote_addr;
      proxy_set_header   X-Forwarded-Host $server_name;
    
    }
    

    Replace <your_domain.com> with the name of your domain, and <your_port> with your localhost port number.

    Restart the nginx daemon, and add an 'A' Record on your domain pointing to the Public IP Address of your web server.

    When you visit <your_domain.com>, you'll see your localhost app being available to the outside internet.

    You need a domain for this. It's cheaper than ngrok, you can buy them from websites like godaddy.com and namecheap.com.