在Debian下选择Laravel版本时,可以参考以下几个因素:
sudo apt update
sudo apt upgrade
sudo apt install nginx
sudo apt install php php-cli php-common php-json php-gmp php-fpm php-xmlrpc php-bcmath php-imagick php-curl php-zip php-gd php-mysql php-xml php-mbstring php-xmlrpc php-intl php-sqlite3
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer create-project --prefer-dist laravel/laravel example-app
/etc/nginx/sites-available/example-app
文件,添加以下内容:server {
listen 80;
server_name example-app.local;
root /home/david/example-app/public;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
location /\.ht {
deny all;
}
}
sudo systemctl restart nginx
storage
和 bootstrap/cache
目录具有适当的写权限。sudo chown -R www-data:www-data /path/to/your/laravel/project/storage
sudo chown -R www-data:www-data /path/to/your/laravel/project/bootstrap/cache
sudo chmod -R 775 /path/to/your/laravel/project/storage
sudo chmod -R 775 /path/to/your/laravel/project/bootstrap/cache
php.ini
),确保路由重写功能已启用。sudo nano /etc/php/8.2/fpm/php.ini
取消以下行的注释:
extension=fileinfo
extension=mbstring
extension=openssl
然后重启PHP-FPM:
sudo systemctl restart php8.2-fpm
以上信息提供了在Debian系统下安装Laravel的步骤,以及对PHP版本和Laravel版本选择的建议。