Laravel 安装

1.Install Composer:
下载安装:
https://getcomposer.org/download/
or
https://developer.aliyun.com/composer

设置镜像地址:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
or
composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/

取消配置:
composer config -g --unset repos.packagist

sudo mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
2.Install Laravel:
composer global require laravel/installer

sudo yum install unzip

composer create-project --prefer-dist laravel/laravel blog "6.*"

cd /usr/share/nginx/html/blog
chmod -R 755 ../blog/
chmod -R 777 storage/
chmod -R 777 bootstrap/cache/

php artisan key:generate
3.Web Server Setting:
vi /etc/nginx/conf.d/default.conf
root  /usr/share/nginx/html/blog/public;
location / {
    try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
    ...
    try_files $uri =404;
    fastcgi_param  PHP_VALUE  "open_basedir=$document_root/../:/tmp/";
}
location ~ /\. {
    deny  all;
}
4.Test Laravel:
http://localhost/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

16 + 8 =