Last Updated: February 25, 2016
· gdotdesign

Easy Virtual Hosts on Ubuntu

For a while now I was struggling with setting up virtual hosts for development servers. I didn't want to install Apache just for this, so I used haproxy for a while but it is a pain to get it right (editing the configs and the hosts file is tiresome)

But now I found out how to do it in a jiff:

Install dnsmasq ( for resolving the domain ), and rinetd ( for port forwarding ).

sudo apt-get install dnsmasq rinetd

Edit /etc/dnsmasq.conf:


Edit /etc/rinetd.conf:

# bindadress    bindport  connectaddress  connectport       80       3000

logfile /var/log/rinetd.log

Restart services:

sudo service rinetd restart
sudo service dnsmasq restart

Now your virtual host is configured and ready to serve your sever that runs on port 3000 on