NGINX 中的位置指令不起作用

NGINX 中的位置指令不起作用

我正在嘗試打開我的 index.php 檔案的位置,例如:

根資料夾是:

/path/to/my/root/folder

使用者用來存取此根資料夾的 url 是:

https://sub.mydomain.net/server/client

每次我使用此位置聲明時,我都會收到 404 或禁止訊息

location /server/client/ {
      alias /path/to/my/root/folder;
      try_files $uri $uri/ /index.php$uri$is_args$args;
   }

我就是無法弄清楚我做錯了什麼。

當然,index.php 位於這裡:

/path/to/my/root/folder/index.php

為了澄清起見,我還聲明了以下內容:

index index.html index.php;

location ~ \.php$ {
      include conf.d/services/php7.conf;
   }

就像我說的,我就是不知道出了什麼問題?

答案1

您並沒有真正發布太多有用的配置或任何錯誤日誌。所以:

  1. 檢查 Nginx 或 PHP 日誌
  2. 檢查目錄的權限
  3. 確保 PHP 配置正確,可以與 Nginx 一起使用。

相關內容