Test subdomain on a linux local machine

Test subdomain on a linux local machine

Welcome to my blog. Help yourself.
----- perrin

2018-10-21 13:45


Suppose that we have a domain "some.com". We want to use subdomains such as "blog.some.com", "forum.some.com".

How to test it locally?

One approach is to use `/etc/hosts`.

Dns server analyze domains first from local config files. So we can just change the content to meet out requirments.

We can change it as following for testing and recover it after we done the job.

127.0.0.1	www.some.com
127.0.0.1	some.com
127.0.0.1	blog.some.com
127.0.0.1	forum.some.com
127.0.0.1	xxx.some.com

We could not use regex to set the subdomains. So it is a little noisy.

 

 

 


Commenter Name
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
Commenter Name
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
Commenter Name
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
Search
Page view info
{'ip': '3.229.122.219', 'lat_lon': (41.890251, 12.492373), 'city': 'Rome', 'pv': 64817, 'cur_pv': 116, 'cur_daily_pv': 3, 'ur_pv': 4, 'ur_cur_all': 1, 'ur_today_all': 4, 'ur_today_cur': 1, 'daily_pv': 226, 'daily_ip': 132, 'whole_ip': 10158, 'ip_delta': 2}
AMap
Baidu Map