美文网首页
TP5 Nginx 提示:模块不存在:index

TP5 Nginx 提示:模块不存在:index

作者: 归隐小赵 | 来源:发表于2020-10-23 15:52 被阅读0次

    配置nginx后,发现TP接口无法正常访问
    默认情况下的ip/think 也无法访问,推测Nginx异常
    查找后,发现是2行nginx配置导致,删除后访问正常

    异常配置:

    server {
      listen 8082;
      access_log /data/www/log/sandbox.log combined;
      error_log /data/www/log/sandbox_error.log;
      
      root /www/xdnice_local/public;
      set $root /www/xdnice_local/public;
      location ~ \.php {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.3-fpm.sock;
            fastcgi_split_path_info ^((?U).+.php)(/?.+)$;  #异常1
            fastcgi_param PATH_INFO $fastcgi_path_info;  #异常2
            fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
        {
            root $root;
        }
        location / {
            root    $root;
            index    index.html index.php;
            if ( -f $request_filename) {
                break;
            }
            if ( !-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
                break;
            }
        }
       } 
       
    

    删除2处异常后,正常访问

    server {
      listen 8082;
      access_log /data/www/log/sandbox.log combined;
      error_log /data/www/log/sandbox_error.log;
      
      root /www/xdnice_local/public;
      set $root /www/xdnice_local/public;
      location ~ \.php {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.3-fpm.sock;
            fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
        {
            root $root;
        }
        location / {
            root    $root;
            index    index.html index.php;
            if ( -f $request_filename) {
                break;
            }
            if ( !-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
                break;
            }
        }
       } 
       
    
    image.png

    相关文章

      网友评论

          本文标题:TP5 Nginx 提示:模块不存在:index

          本文链接:https://www.haomeiwen.com/subject/qybvmktx.html