03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Multisites 198<br />

Adding Virtual Host Entries<br />

When you type an address into your browser, and hit enter; your browser goes through a set of<br />

steps in order to get you the web page you want. First, it queries what’s called a hosts file to see if<br />

the address you typed in is a reference to a local IP address. If not found, the browser then queries<br />

whatever DNS servers are available to the operating system.<br />

A DNS server compares an address (e.g. example.com) with a list of IP addresses it has on file. If an<br />

IP address is found; the browser’s request is forwarded to it and the web page is delivered.<br />

.<br />

This is a rather simplified explanation of the steps involved. You can probably find more details at:<br />

http://en.wikipedia.org/wiki/Internet.<br />

In a sense; the hosts file acts as a DNS server before any remote requests are made. It follows that<br />

the best place to add references to local IP addresses (local web servers) is in the hosts file.<br />

To do that, open the hosts file:<br />

1 sudo vim /etc/hosts<br />

.<br />

If that command gives you errors then you can try running it without the sudo part. Sudo is (simply<br />

speaking) a way to run a command at the highest permission level possible; to ensure it executes<br />

correctly. If may be that you do not have sufficient privileges to run commands as root (with sudo).<br />

.<br />

Vim is a teminal-based text editor. If you’re uneasy using it; what we’re after is editing /etc/hosts.<br />

On a new line, at the bottom of /etc/hosts, add:<br />

1 127.0.0.1 dev.tutorial<br />

.<br />

This was extracted from /etc/hosts.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!