柳暗花明笔记

    osticket ajax.php/config/client URL not supported | 404 的解决办法

    所属分类:[ php&web ] 猫哲学家 发表于:2016-10-29 17:09 浏览:380

    在nginx后添加:

    # Lanmiz add
    if ($request_uri ~ "^/ajax.php(/[^\?]+)") {
    set $path_info $1;
    }
    # Lanmiz add
    location ~ ^/ajax.php/(.*)$ {
    try_files $uri $uri/ /ajax.php;
    }

     

    添加后访问:

    http://loc.support.osticket.com/ajax.php/config/client

    得:

    {"allow_attachments":true,"file_types":".doc,.pdf,.jpg,.jpeg,.gif,.png,.xls,.docx,.xlsx, .txt,.mp4,.zip,.rar","max_file_size":33554432,"max_file_uploads":4,"html_thread":true}

     

    ============================

    以下为较全面的配置,关键就是要解决PATH_INFO这个东东

    # Requests to /api/* need their PATH_INFO set, this does that
    if ($request_uri ~ "^/api(/[^\?]+)") {
    set $path_info $1;
    }

    # /api/*.* should be handled by /api/http.php if the requested file does not exist
    location ~ ^/api/(tickets|tasks)(.*)$ {
    try_files $uri $uri/ /api/http.php;
    }

    # /scp/ajax.php needs PATH_INFO too, possibly more files need it hence the .*\.php
    if ($request_uri ~ "^/okscp/.*\.php(/[^\?]+)") {
    set $path_info $1;
    }

    # Make sure requests to /okscp/ajax.php/some/path get handled by ajax.php
    location ~ ^/okscp/ajax.php/(.*)$ {
    try_files $uri $uri/ /okscp/ajax.php;
    }

    # Set index.php as our directoryindex
    location / {
    index index.php;
    }

    # Send php files off to the PHP-FPM listing on localhost:9000
    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $path_info;
    include fastcgi_params;
    #fastcgi_param QUERY_STRING $query_string;
    }



    # Lanmiz add
    if ($request_uri ~ "^/ajax.php(/[^\?]+)") {
    set $path_info $1;
    }
    # Lanmiz add
    location ~ ^/ajax.php/(.*)$ {
    try_files $uri $uri/ /ajax.php;
    }

     

    标签: nginx 
    上一编文章 apache 修改linux下prefork.c的最大请求并发数 下一编文章 jquery ui Autocomplete 自动完成插件方法说明
    最近文章
    发表评论