29.07.2016 Views

laravel-5

Create successful ePaper yourself

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

Installation 43<br />

• Cache<br />

• Database<br />

• Session<br />

Once Laravel is installed, you should also configure your local environment.<br />

Pretty URLs<br />

Apache<br />

The framework ships with a public/.htaccess file that is used to allow URLs without index.php.<br />

If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.<br />

If the .htaccess file that ships with Laravel does not work with your Apache installation, try this<br />

one:<br />

.<br />

1 Options +FollowSymLinks<br />

2 RewriteEngine On<br />

3<br />

4 RewriteCond %{REQUEST_FILENAME} !-d<br />

5 RewriteCond %{REQUEST_FILENAME} !-f<br />

6 RewriteRule ^ index.php [L]<br />

Nginx<br />

On Nginx, the following directive in your site configuration will allow “pretty” URLs:<br />

.<br />

1 location / {<br />

2 try_files $uri $uri/ /index.php?$query_string;<br />

3 }<br />

Of course, when using Homestead, pretty URLs will be configured automatically.<br />

Environment Configuration<br />

It is often helpful to have different configuration values based on the environment the application is<br />

running in. For example, you may wish to use a different cache driver locally than you do on your<br />

production server. It’s easy using environment based configuration.<br />

To make this a cinch, Laravel utilizes the DotEnv³² PHP library by Vance Lucas. In a fresh Laravel<br />

installation, the root directory of your application will contain a .env.example file. If you install<br />

³²https://github.com/vlucas/phpdotenv

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

Saved successfully!

Ooh no, something went wrong!