Home / PHP

Access to the script '/some.js' has been denied (see security.limit_extensions)

Posted on:2019-10-07 Views:10378 Words:171

After installed nginx, php-fpm on my new oracle cloud free server, I try to deploy my laravel blog site.

But when access home page, js and css files are not loaded.

Some error infomation were shown in nginx error.log file:

2019/09/21 00:38:52 [error] 705#705: *513 FastCGI sent in stderr: "Access to the script '/xxx/public/js/main.js' has been denied (see security.limit_extensions)" while reading response header from upstream, client:, server: www.notefeel.com, request: "GET /js/main.js?t=201810072232 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "www.notefeel.com", referrer: "https://www.notefeel.com/"

Let’s search security.limit_extensions in php configuration:

cd /etc/php
grep limit_extensions -r .

./7.2/fpm/pool.d/www.conf:;security.limit_extensions = .php .php3 .php4 .php5 .php7

Open www.conf file, and append some common resourse file extension:

security.limit_extensions = .php .php3 .php4 .php5 .php7 .html .htm .js .css .jpg .jpeg .gif .png .txt .ico

Then, reload php fpm

sudo service php7.2-fpm reload

Access home page, it works. All css and js files are loaded.

Web Server System Enviroment

  • ubuntu 18.04 LTS
  • nginx version: nginx/1.14.0 (Ubuntu)
  • php 7.2.19
  • Laravel 5.5