Thursday, December 24, 2015

Mac Technique: How to configure an IP address as a custom domain name for a browser

This post is about a Mac technique, not Swift programming.

If an Apache HTTP server is installed on a Raspberry Pi, entering its IP address in a Safari / Chrome browser on a Mac in the same local network of the Raspberry Pi gives this result:



Or the result of a PHP page:



However, is it possible to use a custom domain name to access the above 192.168.xx.xx IP address with a personal Mac?

Yes. The solution is easy. And the good news is: there's no need to pay for the custom URL!!

Just modify the hosts file of Mac using this terminal command:

sudo nano /private/etc/hosts

And add this line:

192.168.xx.xx     yourdomain.com



Save this hosts file and enter your custom domain name in the browser:


This solution also works with PHP.


You may give your server an awesome domain name you like and then you no long need to enter the numbers of your server's IP address in the browser!

Note the different hosts file path:
Mac:                 /private/etc/hosts
Raspberry Pi:   /etc/hosts

References:

App Submission with encryption:
Does my application “contain encryption”? (Stack Overflow)
Apple iTunes export restrictions on apps

No comments:

Post a Comment