简体   繁体   English

在子目录中找不到Nginx 404

[英]Nginx 404 not found in subdir

Okay, i setup a debian install with ispconfig3 , php5-fpm and nginx , the main site, drupal is working fine, even perfect. 好的,我使用ispconfig3php5-fpmnginx (主站点)设置了一个debian安装,drupal运行正常,甚至完美。 But i also have a modded phpbb3 board, in a subdir , named ' forum '. 但我也有一个phpbb3的改装板,在子目录 ,命名为“ 论坛 ”。

Now for some reason i get the following error from nginx when accesing the dir: 现在由于某种原因,我在访问目录时从nginx收到以下错误:

'ERROR 500 - Internal Server Error!' “错误500-内部服务器错误!”

This is the content of the nginx directiv field(for vhost): 这是Nginx Directiv字段的内容(对于vhost):

# search for already compressed files
  gzip_static on;
  gzip on;

  # some images have no mime type
  default_type image/jpeg;

  # 404 generated from php can be rather slow. Uncomment with care
  error_page 404 /index.php;

  # disallow access to version control directory, but return 404, not to disclose information
  location /.git {
    return 404;
  }

  # robots.txt is important for search engines
  location /robots.txt {
    access_log off;
  }

  # This is mostly based on Drupal's stock .htaccess
  location ~* ^.+(\.(txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
    return 404;
  }

  # serve imagecache files directly or redirect to drupal if they do not exist
  location ~* imagecache {
    access_log off;
    expires 30d;
    try_files $uri @drupal;
  }

  # Drupal 7 image stylef
  location ~* image/generate {
    access_log off;
    expires 30d;
    try_files $uri @drupal;
  }

  # serve static files directly
  location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|swf|flv)$ {
    access_log off;
    log_not_found off;
    expires 30d;
  }

location @rewrite {
      # Some modules enforce no slash (/) at the end of the URL
      # Else this rewrite block wouldn't be needed (GlobalRedirect)
       rewrite ^/(.*)$ /index.php?q=$1;
break;
    }

  # This rewrites pages to be sent to PHP processing
  location @drupal {
rewrite  ^/(.*)$  /index.php?q=$1  last;

}

location / {
    try_files $uri @cache;
  }

  # This will try to see if we have a boost file in place. no harm done if this is not used
  location @cache {
    # queries, drupal cookies, or not GET methods, all require PHP processing.
    if ($query_string ~ ".+") {
      return 405;
    }
    if ($http_cookie ~ "DRUPAL_UID" ) {
      return 405;
    }
    if ($request_method !~ ^(GET|HEAD)$ ) {
      return 405;
    }
    error_page 405 = @drupal;

    # Drupal uses 1978 - I am 4 years older than Dries :)
    add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
    add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
    try_files /cache/normal/$host/${uri}_.html /cache/mobile/$host/${uri}_.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
  }


location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $request_filename;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_param PATH_INFO $fastcgi_script_name;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 4k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }

location /forum {
               root /var/www/ashladan.net/web;
               index index.php index.html index.htm;
               location ~ ^/forum/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/ashladan.net/web;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $request_filename;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_param PATH_INFO $fastcgi_script_name;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 4k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
               }
               location ~* ^/forum/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/ashladan.net/web;
               }
        }

It may be standard PHP response for uncaught exception / fatal / syntax error with no output. 对于未捕获的异常/致命/语法错误,它可能是标准的PHP响应,没有输出。

You can either turn on error logging in php.ini and check your log file, or just at the beginning of your index.php file in this directory add two lines: 您可以打开php.ini中的错误日志记录并检查您的日志文件,也可以仅在此目录中index.php文件的开头添加两行:

<?php
error_reporting(E_ALL);
ini_set('display_errors','on');

So if it is PHP's fault you will get more details on this error. 因此,如果这是PHP的错误,您将获得有关此错误的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM