1. 程式人生 > >阿里雲安裝laravel填坑之路

阿里雲安裝laravel填坑之路

1.composer安裝命令:

composer global require "laravel/installer"

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 9 installs, 0 updates, 0 removals
  - Installing symfony/process (v4.0.6): Downloading (100%)         
  - Installing symfony/filesystem (v4.0.6): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.7.0): Downloading (100%)         
  - Installing symfony/console (v4.0.6): Downloading (100%)         
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
  - Installing guzzlehttp/guzzle (6.3.2): Downloading (100%)         
  - Installing laravel/installer (v2.0.1): Downloading (100%)         
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/lock ()
symfony/console suggests installing psr/log (For using the console logger)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file

Generating autoload files

直接使用laravel命令有錯,需要手動新增許可權及給命令

~/.config/composer/vendor# chmod +x laravel/installer/laravel 

~/.config/composer/vendor# ln laravel/installer/laravel /usr/bin/laravel

訪問路徑為/blog/public

編輯 環境變數檔案 vi /etc/environment

新增路徑 /root/.config/composer/vendor/bin

這樣就可以全域性使用laravel命令

2.詳細查看了官方開發環境Homestead,覺得在已經有云伺服器的情況下,可以不用安裝,用phpstorm配置遠端同步也一樣開發方便。

3.美化url,nginx 配置檔案新增紅色部分:

location / {
            root   html;
            index  index.html index.htm index.php;
                        add_header 'Access-Control-Allow-Origin' '*';
            try_files $uri $uri/ /index.php?$query_string;
        }