[英]Issues with static files - hosting PHP app under subdirectory using nginx
[英]Nginx - Php subdirectory files keep redirecting to homepage
我似乎無法在任何地方在線找到適合我的情況的解決方案。 我的nginx被配置為使用bigbluebutton作為默認值,因此我已經設置了mysql和php以使用藍色的大按鈕位置。 我已經成功獲取了php info文件,該文件顯示在文件的根目錄中,但是如果我將該文件放在子目錄中,則會重定向到該根目錄。 僅子目錄.php文件中的html文件不會發生這種情況。 最初,我會在子目錄中的php文件上獲得404,但現在我打開了短標簽(即使沒有使用過,也將我重定向到了大藍根。)對不起,我很新手,任何幫助都是真正的贊賞。
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;
}
}
您似乎沒有為您的location ~ \\.php$
設置root
location ~ \\.php$
塊。 如果您有許多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;
...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.