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
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 -
Install nginx on the server hosting your content https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/ This process changes based on your operating system. Make sure to start the nginx daemon after installation.
Configure nginx
Enter the sites-enabled
directory (usually /etc/nginx/sites-enabled/) and edit the file named default
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.