logo

TestLocalhost.net

There's no place like 127.0.0.1

If you need to a domain name to test your web application, with or without SSL, how it looks as Android app, you may use TestLocalhost's subdomains to test.
What you can do with this TestLocalhost's subdomains:
Case 1: You need to test your localhost application (from your local machine) with a hostname

Use http://dev.testlocalhost.net or https://dev.testlocalhost.net - this will resolved to your computer (127.0.0.1)
You may also specify the port number along with the domain name.
If you encounter 404 error, most likely that's because you haven't configured your webserver; here is how to configure it:

Edit your nginx configuration
sudo vi /etc/nginx/sites-enabled/default
server {
listen 80;
server_name *.testlocalhost.net;
location / {
root /var/www/html/;
}
Edit your Apache2 configuration
sudo vi /etc/apache2/sites-available/your_domain_or_ip.conf
<VirtualHost *:80>
ServerName *.testlocalhost.net
DocumentRoot /var/www/html/
</VirtualHost>


Case 2: You need to test your localhost application from a mobile / another computer (must be within the same infranet) using domain name

1. find out what's your IP Address
ipconfig
hostname -I | awk '{print $1}'
ipconfig getifaddr en1

2. use one of these subdomains to access your computer's IP Address
LinkWithout SSLWith SSLIP Address
a0.testlocalhost.net
http
https
10.0.0.2
a1.testlocalhost.net
http
https
10.0.1.2
a2.testlocalhost.net
http
https
10.0.2.2
b0.testlocalhost.net
http
https
172.16.0.2
b1.testlocalhost.net
http
https
172.16.1.2
b2.testlocalhost.net
http
https
172.16.2.2
c0.testlocalhost.net
http
https
192.168.0.2
c1.testlocalhost.net
http
https
192.168.1.2
c2.testlocalhost.net
http
https
192.168.2.2
c3.testlocalhost.net
http
https
192.168.3.2
c8.testlocalhost.net
http
https
192.168.8.2
c15.testlocalhost.net
http
https
192.168.15.2
c100.testlocalhost.net
http
https
192.168.100.2
c123.testlocalhost.net
http
https
192.168.123.2
c254.testlocalhost.net
http
https
192.168.254.2
In general, we avoid IP Address ending with .0 or .1 because it maybe reserved for the router
If your computer IP Address doesn't end with .2, you need to go to your router and change the IP Address


Case 3: You need to test your localhost application using SSL, to be tested on your computer or another computer/mobile device

1. Download SSL

The certificate will expire in 10 years (your actual time may be less than that).
Because this is a self signed certificate, the browser will give warning.
Unzip in a directory and adjust the name and location of the certificates (in configuration) accordingly.
You may create your own certificate by following this step:
Nginx
Apache
The certificate will expire every 3 month (your actual time may be less than that), so you need to re-download
In the even the certificate is revoked, please let me know
Unzip in a directory and adjust the name and location of the certificates (in configuration) accordingly.

2. install on your application
Edit your nginx configuration
sudo vi /etc/nginx/sites-enabled/default
server {
listen 80;
server_name *.testlocalhost.net;
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/selfsigned.crt;
ssl_certificate_key /etc/ssl/private/selfsigned.key;
location / {
root /var/www/html/;
}
Edit your Apache2 configuration
sudo vi /etc/apache2/sites-available/your_domain_or_ip.conf
<VirtualHost *:80>
ServerName *.testlocalhost.net
DocumentRoot /var/www/html/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/selfsigned.key
</VirtualHost>

Case 4: You want to see how your application looks in Android

1. You need choose one (or more) of subdomain to point to your localhost (See case 1-3).
2. Install Test Localhost (Full Screen) app or Test Localhost (Standalone) app and open it
3. Click one of the subdomain that will point to your localhost

You can even test app shortcuts (if your Android supports it)
the 1st shortcut goes to http://a0.testlocalhost.net/shortcut (10.0.0.2)
the 2nd shortcut goes to http://b0.testlocalhost.net/shortcut (172.16.0.2)
the 3rd shortcut goes to http://c0.testlocalhost.net/shortcut (192.168.0.2)
the 4th shortcut goes to http://c100.testlocalhost.net/shortcut (192.168.100.2)

This application is also Progressive Web Application (PWA), so you can install this web as a PWA and see how your application looks inside PWA.
To remove the address bar in PWA application, unfortunately you need to make your application as PWA.


Case 5: Need top level domain to test your localhost application?

Use http://testlocalhost.com or https://testlocalhost.com - this will resolve to 127.0.0.1 (not related to this website)


Case 6: Need to your localhost application to be accessible worldwide or test your webhook?

The easiest is to use any subdomain service.
In short, you create a subdomain, tell the router where to route the traffic (which computer will handle http request) and use the service to point to your IP Address
One of the best subdomain service is afraid.org (not related to this website)
Use reverse proxy to expose your localhost to the world.
One of the best reverse proxy service is https://ngrok.com/ (not related to this website)


Case 7: Need to send emails from your localhost

You can use fake smtp server to capture your email - one of this is: Mail Trap
You can certainly try to install smtp server yourself, but without properly configured, your email may ends up in Spam folder.
Alternatively, you can use 3rd party service, such as Mail Gun, Send In Blue or Send Grid.


Referral Links

If you find this website useful, share this on your social media and/or link back to us.

Do you have any suggestion, want to report revoked SSL, missing subdomains, etc? Contact us!

Ready to have your own domain name?
Get a .COM for just $5.98!

Ready to take your website to the next level with new template?
UpThemes

Finally ready to move to real server?
Lightning-fast Cloud Servers with High Availability & Fault-Tolerant SSD storage. Enjoy Public Cloud with 100% uptime.

Ready to upgrade your computer?
Upgrade your Computer