无法访问此站点,在 nginx、debian 11 上,尝试在其上托管 laravel

无法访问此站点,在 nginx、debian 11 上,尝试在其上托管 laravel

我已经在服务器上全新安装的 Debian 中完成了此操作。

sudo apt install nginx
sudo systemctl start nginx
sudo systemctl status nginx
curl -sSL https://packages.sury.org/php/apt.gpg -o sury-php.gpg
sudo mv sury-php.gpg /etc/apt/trusted.gpg.d/
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

sudo apt update
sudo apt upgrade

sudo apt install -y php8.2-fpm php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip php8.2-intl

sudo service php8.2-fpm restart
sudo nano /etc/nginx/sites-available/example.com

server {
    listen 80;
    listen [::]:80;

    server_name example.com www.example.com;
    root /var/www/example.com/public;
    
    index index.html index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
     }

    location ~ /\.ht {
        deny all;
    }
}

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
sudo nginx -t
sudo systemctl restart nginx

现在/var/www/example.com/public,我创建了一个带有 echo Hello world 的虚拟 index.php 文件。

错误和访问日志中没有显示任何内容。我该如何调试?顺便说一下,在 IP 上,它显示了欢迎 nginx 页面,这可能是因为回退到默认服务器配置。我可能遗漏了什么?

相关内容