【发布时间】:2018-12-19 15:01:59
【问题描述】:
早上好, 我想制作可以与不同 php 应用程序(symfony 和 Thelia)一起使用的相同 nginx 虚拟主机。 我的问题是 try_files 指令。在 symfony 中,try_files 必须以 app.php 为目标,但在 Thelia 中,它必须以 index.php 为目标。 所以想修改try_files语句如下:
server {
listen 80;
server_name *.tld;
root /var/www/web;
location / {
try_files $uri /app.php$is_args$args /index.php$is_args$args;
}
location ~ ^/(app|app_dev|config|index|index_dev)\.php(/|$) {
fastcgi_pass php_alias:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param APP_ENV dev;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
不幸的是,它不起作用。不再解释 PHP。那么如何在try_files语句中注册多个php文件呢?
【问题讨论】:
-
您是否有特定的理由将给定的正则表达式用于 PHP 文件而不是标准的
location ~ \.php(/|$)? -
@IVOGELOV 是的,我需要这个特定的配置,但我看不到与 try_files 的关系。