使用IP/~账号无法访问我的网站,显示不支持

Can't access my website using IP/~account, showing not supported

我无法访问我的临时 URL,它只显示 "Not Supported"。我上传了 laravel 个文件。我已经配置了 index.php 和 .envshowing not supported

  1. 如果您的网站根目录是 syksxyz 目录,那么 public 路径将是 syksxyz/public

  2. 为确保其正常工作,您可以在 public 文件夹中添加一个 index.html 文件,以在调试 php 部分之前查看映射是否正确它.

根据您使用的网络服务器,Apache 或 Nginx,您可以按照官方文档配置您的网络服务器。 Web Server Configuration

要使用 laravel,您必须正确配置您的服务器。仅将代码上传到服务器不会使您的网站按预期工作。配置的重要部分是将所有请求定向到 index.php.

这是我的 Nginx 配置文件的一部分。

server {
    listen 80;
    server_name my-website.test;
    root "/path/to/my-laravel-project/public";

    index index.html index.htm index.php;

    charset utf-8;

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

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

    }

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

请记住,网站 root 应指向 ./laravel-project/public 目录,因为 laravel-project/public/index.php 文件将处理您网站的所有请求。