2016-01-21 32 views
1

我似乎無法找到任何適用於我的情況的解決方案。我的nginx被配置爲使用bigbluebutton作爲默認值,所以我設置了mysql和php來使用大藍色按鈕位置。我已經成功地獲得了php info文件以顯示在文件的根目錄中,但是如果我將該文件放在子目錄中,我將重定向到根目錄。這不會發生在子目錄中的.php文件中的html文件。最初我會得到一個404子目錄中的PHP文件,但現在我打開短標籤(即使沒有使用過,它會將我重定向到大藍色的根目錄。我很抱歉,我是如此noob,任何幫助是真正的讚賞。Nginx - Php子目錄文件保持重定向到主頁

server { 
listen 80; 
server_name **.**.***.**; 

access_log /var/log/nginx/bigbluebutton.access.log; 

# Handle RTMPT (RTMP Tunneling). Forwards requests 
# to Red5 on port 5080 
    location ~ (/open/|/close/|/idle/|/send/|/fcs/) { 
     proxy_pass   http://127.0.0.1:5080; 
     proxy_redirect  off; 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

     client_max_body_size  10m; 
     client_body_buffer_size 128k; 

     proxy_connect_timeout  90; 
     proxy_send_timeout   90; 
     proxy_read_timeout   90; 

     proxy_buffering   off; 
     keepalive_requests   1000000000; 
    } 

# Handle desktop sharing tunneling. Forwards 
# requests to Red5 on port 5080. 
    location /deskshare { 
     proxy_pass   http://127.0.0.1:5080; 
     proxy_redirect  default; 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
     client_max_body_size  10m; 
     client_body_buffer_size 128k; 
     proxy_connect_timeout  90; 
     proxy_send_timeout   90; 
     proxy_read_timeout   90; 
     proxy_buffer_size   4k; 
     proxy_buffers    4 32k; 
     proxy_busy_buffers_size 64k; 
     proxy_temp_file_write_size 64k; 
     include fastcgi_params; 
    } 

# BigBlueButton landing page. 
    location/{ 
     try_files $uri $uri/ /index.html;   
     root /var/www/bigbluebutton-default; 
     index index.php index.html index.htm; 
    expires 1m; 
    } 

# Include specific rules for record and playback 
    include /etc/bigbluebutton/nginx/*.nginx; 

    error_page 404 /404.html; 

    # Redirect server error pages to the static page /50x.html 
    # 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
      root /var/www/nginx-default; 
    } 

location ~ \.php$ { 
      try_files $uri =404; 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME  
      $document_root$fastcgi_script_name; 
      include fastcgi_params; 

    } 
} 
+0

請幫忙...添加服務器位置塊機智h別名或根目錄以及各種配置無法正常工作......我只是繼續重定向,肯定有一些遺漏...... – brigitte18

+0

子目錄的名稱是什麼?那個子目錄的路徑是什麼? –

+0

/kemsley它位於/ var/www/bigbluebutton-default/kemsley – brigitte18

回答

1

您似乎沒有爲您的location ~ \.php$root集。如果你有一些location塊一個共同的根源,你應該的水平移動root指令到圍繞server塊。像這樣的片段:

root /var/www/bigbluebutton-default; 

location/{ 
    index index.php index.html index.htm; 
    try_files $uri $uri/ /index.html;   
    expires 1m; 
} 
location ~ \.php$ { 
    try_files $uri =404; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    ... 
} 
+0

是的!神奇!!!!! OH MY GOODNESSSS !!!!!!!!!!謝謝你謝謝你,謝謝你!!!!! – brigitte18

+0

THAAAANK YOUUU !!! – brigitte18