nginx中報Access denied.

xiaosheng發表於2020-12-07
  • 本地環境: NGINX + PHP5.6

  • 需求: 訪問以 .l 結尾的檔案, 該檔案中寫的是 PHP 的程式碼

  • NGINX 配置檔案如下:

    server {
        listen 80;
        listen [::]:80;
        server_name www.crm.test;
        access_log /data/wwwlogs/www.crm.test_nginx.log combined;
        index index.html index.htm index.php login.html;
        root /data/wwwroot/www.crm.test;
    
        include /usr/local/nginx/conf/rewrite/other.conf;
    
        location ~ [^/]\.php(/|$) {
          #fastcgi_pass remote_php_ip:9000;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/dev/shm/php-cgi.sock;
          fastcgi_index index.php;
          include fastcgi.conf;
        }
    
       location ~ \.l$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/dev/shm/php-cgi.sock;
          fastcgi_index index.php;
          include fastcgi.conf;
          include fastcgi_params;
        }
    
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
          expires 30d;
          access_log off;
        }
        location ~ .*\.(js|css)?$ {
          expires 7d;
          access_log off;
        }
        location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
          deny all;
        }
    }
  • 報錯如下:

nginx中報Access denied.


  • 網上搜了一下, 大部分都是在說修改 php-fpm.conf 檔案修改, 已經修改過了, 但還是不行

nginx中報Access denied.


  • 所以求各位大哥指點下
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章