将symfony4从根目录移到

时间:2018-09-26 09:09:23

标签: symfony subdirectory

我在项目的根目录上运行symfony,但是现在我需要将此文件夹移动到嵌套结构上。

我的虚拟主机如下:

server {
  listen 80;

    server_name ~^(?<folder>[^.]*).magana.dev.example.fr;


    charset utf-8;
    index index.php index.html index.htm;

    set $symfonyRoot /var/www/projects/dev/magana/$folder/htdocs/app/public;
        set $symfonyScript index.php;

    root /var/www/projects/dev/magana/$folder/htdocs;
    access_log /var/www/projects/dev/magana/$folder/access.log;
    error_log  /var/www/projects/dev/commons/logs/magana_error.log;

    client_max_body_size 200M;

    location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp$
        access_log        off;
        log_not_found     off;
        expires           30d;
        add_header Pragma "public";
    }
    location /app {
                root $symfonyRoot;
                rewrite ^/app/(.*)$ /$1 break;
                try_files $uri @symfonyFront;
        }
    location @symfonyFront {
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $symfonyRoot/$symfonyScript;
                fastcgi_param SCRIPT_NAME /app/$symfonyScript;
                fastcgi_param REQUEST_URI /app$uri?$args;
        }


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


    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param APPLICATION_ENV magana;
        include fastcgi_params;
        fastcgi_read_timeout 600;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SERVER_NAME $folder.magana.dev.hexis.fr;
    }

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

当我访问应用程序时出现错误: 找不到“ GET / app”的路线

我需要在哪里更改symfony-web-dir和kernel.project_dir?

有什么主意吗?

0 个答案:

没有答案