Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Nginx、Laravel动态重定向_Php_Laravel_Nginx - Fatal编程技术网

Php 使用Nginx、Laravel动态重定向

Php 使用Nginx、Laravel动态重定向,php,laravel,nginx,Php,Laravel,Nginx,我试图根据命令URL重定向到Laravel文件夹,如下所示 exampl.domain.com/test/必须将我重定向到test文件夹中的laravel项目。实际上,我做了这个配置,但问题是我的主URL将 example.domain.com/test这给了我404错误,因为我的web.conf中没有路由 这是我的nginx配置 server { listen 80; listen 443 ssl; server_name example.domain.com/$1/;

我试图根据命令URL重定向到Laravel文件夹,如下所示 exampl.domain.com/test/必须将我重定向到test文件夹中的laravel项目。实际上,我做了这个配置,但问题是我的主URL将
example.domain.com/test
这给了我404错误,因为我的web.conf中没有路由 这是我的nginx配置

server {
 listen 80;
  listen 443  ssl;
    server_name   example.domain.com/$1/;
    root /var/www/html/$1/public/;

    ssl_certificate /etc/letsencrypt/live/qulakexam.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/qulakexam.com/privkey.pem; # managed by Certbot
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index 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(/|$) {
 proxy_http_version 1.1;
        proxy_set_header Connection "";
         fastcgi_split_path_info  ^(.+\.php)(/.+)$;
         fastcgi_index            index.php;
         fastcgi_pass             127.0.0.1:9000;
         include                  fastcgi_params;
         fastcgi_param   PATH_INFO       $fastcgi_path_info;
         fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }

    location ~ /\.(?!well-known).* {
        deny all;
}
}
但是我有一个404错误,甚至我将public/index.php和.htaccess文件复制到根目录并更改了这些行

需要目录'/供应商/autoload.php'

$app=require_onceDIR'/bootstrap/app.php'

但是,唯一的主路由与exampl.domain.com/test/类似,它将我重定向到登录页面,但所有页面和路由都不工作

我该怎么做