美文网首页
nginx下配置laravel

nginx下配置laravel

作者: 不留余白 | 来源:发表于2018-04-18 17:59 被阅读0次

    安装composer

    brew install composer

    修改镜像

    composer config -g repo.packagist composer https://packagist.phpcomposer.com

    全局安装laravel

    • 添加commposer全局变量

    export PATH=$PATH:~/.composer/vendor/bin

    苹果系统: $HOME/.composer/vendor/bin

    GNU / Linux发行版: $HOME/.config/composer/vendor/bin

    • 通过 Laravel 安装器安装

    首先,通过 Composer 下载 Laravel 安装器。

    composerglobalrequire"laravel/installer=~1.1"

    • 通过laravel命令生成

    laravelnewblog 将会在当前目录下创建一个叫 blog 的目录

    • 权限设置

    Laravel框架有一个目录需要额外设置权限: 需要为 app/storage 目录下的文件设置写权限。

    chmod -R 777 storage/

    .nginx 配置文件

    server {  
            listen  80;    
            server_name aa.com;    
            set $root_path '/code/laravelStudy/public';    
            root $root_path;    
            index index.php index.html index.htm;    
            try_files $uri $uri/ @rewrite;    
            location @rewrite {    
                rewrite ^/(.*)$ /index.php?_url=/$1;    
            }    
            location ~ \.php {    
                fastcgi_pass 127.0.0.1:9000;    
                fastcgi_index /index.php;    
                fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
                fastcgi_param PATH_INFO       $fastcgi_path_info;    
                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
                include                       fastcgi_params;  
            }    
            location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {    
                root $root_path;    
            }    
            location ~ /\.ht {    
                deny all;    
            }    
        }
    

    相关文章

      网友评论

          本文标题:nginx下配置laravel

          本文链接:https://www.haomeiwen.com/subject/qulbkftx.html