看起来您在尝试设置 Laravel 时遇到了问题
php -v
composer --version
如果没有安装,请访问 PHP 官方网站 和 Composer 官方网站 下载并安装它们。
composer global require laravel/installer
确保 ~/.composer/vendor/bin
(macOS 和 Linux)或 %APPDATA%\Composer\vendor\bin
(Windows)已添加到您的 PATH
环境变量中。
your-project-name
替换为您的项目名称:laravel new your-project-name
www-data
或 nginx
)具有对 your-project-name
文件夹的读写权限。运行以下命令:sudo chown -R www-data:www-data your-project-name
sudo chmod -R 755 your-project-name/storage
sudo chmod -R 755 your-project-name/bootstrap/cache
public
文件夹。这里有一个简单的 Apache 虚拟主机示例:<VirtualHost *:80>
ServerName your-domain.test
DocumentRoot /path/to/your-project-name/public
<Directory /path/to/your-project-name/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
对于 Nginx,您可以参考这个示例:
server {
listen 80;
server_name your-domain.test;
root /path/to/your-project-name/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
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$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。