03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Multisites 200<br />

You can learn more about virtual host entries, in Apache2, at: http://httpd.apache.org/docs/current/vhosts/examples.h<br />

.<br />

Creating Nginx Virtual Hosts<br />

Similar to Apache2, Nginx virtual host entries are created by manipulating the configuration files<br />

usually located in /etc/nginx/sites-available/. You can edit the default file, and add the entries to<br />

it, or you can create new files.<br />

.<br />

If you choose to create new files for your virtual host entries, then you will need to symlink them<br />

to /etc/nginx/sites-enabled/* where ***** matches the name of the files you create in the sitesavailable<br />

folder.<br />

The expanded syntax of virtual host entries can be quite a bit to type/maintain; so I have a few go-to<br />

lines I usually use:<br />

1 server {<br />

2 listen 80;<br />

3 server_name dev.site1;<br />

4 root /var/www/site1;<br />

5 index index.php;<br />

6<br />

7 location ~ \.php$ {<br />

8 try_files $uri =404;<br />

9 fastcgi_split_path_info ^(.+\.php)(/.+)$;<br />

10 fastcgi_pass unix:/var/run/php5-fpm.sock;<br />

11 fastcgi_index index.php<br />

12 include fastcgi_params;<br />

13 }<br />

14 }<br />

.<br />

This was extracted from /etc/nginx/sites-available/default.

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

Saved successfully!

Ooh no, something went wrong!