首页 > 文章归档 > OS X 10.9 安装配置 laravel4

OS X 10.9 安装配置 laravel4

Publish:

  1. 从Laravel官网下载Laravel installer PHAR archive, 重命名为laravel, 放到/usr/local/bin下.
  2. 使用laravel new demo创建一个项目为demo, 并初始化文件目录.
  3. 配置nginx指向demo目录, 并将index文件指向server.php

     server {
         listen 80;
         server_name laravel.local;
         root /path/to/demo;
         index index.html index.htm server.php;
    
         location / {
             if (!-e $request_filename) {
                 rewrite  ^(.*)$  /server.php?s=$1  last;
                 break;
             }
         }
    
         location ~ \.php$ {
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  server.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        fastcgi_params;
         }
     }
    
  4. 在hosts文件中添加一条host记录

     127.0.0.1 laravel.local
    
  5. 设置laravel的app/storage目录为可写

     chmod -R 777 app/storage
    
  6. 使用homebrew为osx安装php的mcrypt扩展(laravel需要).

     brew install php54-mcrypt --without-homebrew-php
    
  7. 为php添加mcrypt的配置

     sudo su
     cp /etc/php.ini.default /etc/php.ini
     echo 'extension="/usr/local/Cellar/php54-mcrypt/5.4.31/mcrypt.so"' >> /etc/php.ini
    
  8. 启动php-fpm

     sudo php-fpm
    
  9. 访问http://laravel.local即可看到正常运行的laravel demo

声明: 本文采用 BY-NC-SA 授权。转载请注明转自: OS X 10.9 安装配置 laravel4 - 自说Me话