├── Boxfile ├── README.md ├── apache.conf ├── lighttpd.conf └── nginx.conf /Boxfile: -------------------------------------------------------------------------------- 1 | global: 2 | 3 | web1: 4 | php_upload_max_filesize: "20M" 5 | php_post_max_size: "20M" 6 | name: laravelapp 7 | shared_writable_dirs: 8 | - /storage/cache 9 | - /storage/database 10 | - /storage/logs 11 | - /storage/sessions 12 | - /storage/views 13 | - /storage/work 14 | # - /public/uploads uncomment this if users store uploads 15 | document_root: /public 16 | php_version: 5.4.14 17 | php_extensions: 18 | - curl 19 | - memcached 20 | - imagick 21 | - mbstring 22 | - pdo_mysql 23 | - mcrypt 24 | - gd 25 | # after_build: uncomment this you need composer 26 | # - "curl -s https://getcomposer.org/installer | php" 27 | # - "php composer.phar install" 28 | before_deploy: 29 | - "php artisan migrate:install" 30 | - "php artisan migrate" 31 | after_deploy: 32 | - "rm -f storage/cache/*" 33 | - "rm -f storage/views/*" 34 | db1: 35 | name: laravelapp 36 | type: mysql 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Webserver Configurations 2 | 3 | This repository contains some server configuration files to get Laravel 4 running 'out-of-the-box' on a number of web servers. They will be used as examples within my upcoming book 'Code Bright'. 4 | 5 | Contributions are encouraged. Let's make a set of bulletproof configurations for the Laravel framework! 6 | 7 | Currently supported: 8 | 9 | - Apache 10 | - Nginx 11 | - LigHTTPd 12 | - Pagodabox Boxfile with PHP 5.4 13 | 14 | Thanks! 15 | -------------------------------------------------------------------------------- /apache.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Host that will serve this project. 4 | ServerName app.dev 5 | 6 | # The location of our projects public directory. 7 | DocumentRoot /path/to/our/public 8 | 9 | # Useful logs for debug. 10 | CustomLog /path/to/access.log common 11 | ErrorLog /path/to/error.log 12 | 13 | # Rewrites for pretty URLs, better not to rely on .htaccess. 14 | 15 | 16 | Options -MultiViews 17 | RewriteEngine On 18 | RewriteCond %{REQUEST_FILENAME} !-f 19 | RewriteRule ^ index.php [L] 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /lighttpd.conf: -------------------------------------------------------------------------------- 1 | $HTTP["host"] =~ "example.com$" { 2 | server.document-root = "/path/to/our/public/" 3 | accesslog.filename = "/path/to/access.log" 4 | 5 | alias.url = () 6 | url.redirect = () 7 | url.rewrite-once = ( 8 | "^/(css|img|js|fonts)/.*\.(jpg|jpeg|gif|png|swf|avi|mpg|mpeg|mp3|flv|ico|css|js|woff|ttf)$" => "$0", 9 | "^/(favicon\.ico|robots\.txt|sitemap\.xml)$" => "$0", 10 | "^/[^\?]*(\?.*)?$" => "index.php/$1" 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | # Port that the web server will listen on. 4 | listen 80; 5 | 6 | # Host that will serve this project. 7 | server_name app.dev; 8 | 9 | # Useful logs for debug. 10 | access_log /path/to/access.log; 11 | error_log /path/to/error.log; 12 | rewrite_log on; 13 | 14 | # The location of our projects public directory. 15 | root /path/to/our/public; 16 | 17 | # Point index to the Laravel front controller. 18 | index index.php; 19 | 20 | location / { 21 | 22 | # URLs to attempt, including pretty ones. 23 | try_files $uri $uri/ /index.php?$query_string; 24 | 25 | } 26 | 27 | # Remove trailing slash to please routing system. 28 | if (!-d $request_filename) { 29 | rewrite ^/(.+)/$ /$1 permanent; 30 | } 31 | 32 | # PHP FPM configuration. 33 | location ~* \.php$ { 34 | fastcgi_pass unix:/var/run/php5-fpm.sock; 35 | fastcgi_index index.php; 36 | fastcgi_split_path_info ^(.+\.php)(.*)$; 37 | include /etc/nginx/fastcgi_params; 38 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 39 | } 40 | 41 | # We don't need .ht files with nginx. 42 | location ~ /\.ht { 43 | deny all; 44 | } 45 | 46 | # Set header expirations on per-project basis 47 | location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ { 48 | expires 365d; 49 | 50 | } 51 | } 52 | --------------------------------------------------------------------------------