阿里云安装laravel填坑之路

本文介绍了如何使用Composer安装Laravel并进行必要的权限设置,同时探讨了Homestead的使用场景,并给出了美化URL的Nginx配置建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值