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;
}