Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Nginx限制OctoberCMS中的.htm页面和部分_Php_Laravel_Nginx_Laravel 5_Octobercms - Fatal编程技术网

Php 使用Nginx限制OctoberCMS中的.htm页面和部分

Php 使用Nginx限制OctoberCMS中的.htm页面和部分,php,laravel,nginx,laravel-5,octobercms,Php,Laravel,Nginx,Laravel 5,Octobercms,我正在使用,基于和,与和 如果我访问localhost:8888/mypage,php被呈现,但源代码被隐藏 但是如果我访问localhost:8888/themes/mysite/pages/mypage.htm我可以在浏览器中查看所有php源代码 这应该限制对这些文件的访问 但它不起作用。我把它放在我的网站上,然后重新启动了Nginx。我仍然可以访问.htm文件 我的Nginx站点可用: server { listen 80; server_name localhost:8

我正在使用,基于和,与和

如果我访问localhost:8888/mypage,php被呈现,但源代码被隐藏

但是如果我访问localhost:8888/themes/mysite/pages/mypage.htm我可以在浏览器中查看所有php源代码

这应该限制对这些文件的访问

但它不起作用。我把它放在我的网站上,然后重新启动了Nginx。我仍然可以访问.htm文件

我的Nginx站点可用:

server {
    listen 80;

    server_name localhost:8888;

    root /var/www/mysite/public;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
        include  /etc/nginx/mime.types;
    }

    rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break;
    rewrite ^bootstrap/.* /index.php break;
    rewrite ^config/.* /index.php break;
    rewrite ^vendor/.* /index.php break;
    rewrite ^storage/cms/.* /index.php break;
    rewrite ^storage/logs/.* /index.php break;
    rewrite ^storage/framework/.* /index.php break;
    rewrite ^storage/temp/protected/.* /index.php break;
    rewrite ^storage/app/uploads/protected/.* /index.php break;

    location ~ \.php$ {
        # With php7-fpm:
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi.conf;
    }

    # Support Search Engine Friendly URLs
    location ~ / {
        try_files $uri $uri/ /index.php?q=$request_uri;
        include  /etc/nginx/mime.types;
    }

    # Deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;
    }
}

我在后面加了一个斜杠解决了这个问题^

rewrite ^/themes/.*/(layouts|pages|partials)/.*.htm /index.php break;

它现在转发到/404。

我通过在后面加一个斜杠解决了这个问题^

rewrite ^/themes/.*/(layouts|pages|partials)/.*.htm /index.php break;
它现在转发到/404