[英]nginx server with dynamic index is not executing php
我嘗試在同一位置設置我的 php 后端和我的 vue。 基於X-Requested-With
header 服務器應該決定是使用后端還是交付 vue。 現在vue文件的交付工作正常,但是php沒有執行。
信息:在 X-URI 的 position 中, $uri
是/index.php
,但它沒有運行 php
# Backend
if ($http_x_requested_with = "XMLHttpRequest") {
set $INDEX "index.php";
set $DOCOUMENTROOT "C:/server/web/www/altv_gadget/public";
set $SERVING "LaminasMVC";
}
# Vue Frontend
if ($http_x_requested_with != "XMLHttpRequest") {
set $INDEX "index.html";
set $DOCOUMENTROOT "C:/server/web/www/altv_gadget/dist";
set $SERVING "Vue";
}
# Directory Indexes
index $INDEX;
# Document Root
root $DOCOUMENTROOT;
# Serving Header
add_header X-Serving $SERVING;
# Location
location / {
try_files $uri $uri/ /index.php$is_args$args /index.html$is_args$args;
}
add_header X-URI $uri;
# For PHP files, pass to php_farm
location ~ \.php$ {
add_header X-PHP "1";
fastcgi_pass php_farm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
我希望有人知道如何解決這個問題。
我不知道我的問題是什么,但它似乎工作知道。 對於我的具體解決方案,我使用了try_files $uri $uri/ /$INDEX$is_args$args;
根據我的參數使用我的index.html
或index.php
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.