我试图保证我的Limesurvey 2.0.5pipe理页面(运行在Ubuntu 12.04,Nginx 1.19,PHP5.3.10,PHP-FPM)。
pipe理页面应该只能从一个特定的子网访问,所以在我的conf使用允许172.16.1.0/24
服务器conf:
server { listen 80; set $host_path "/opt/limesurvey"; server_name www.example.tld root $host_path; charset utf-8; try_files $uri /index.php?$args; location ~ ^/(protected|framework|themes/\w+/views) { deny all; } # admin page only for lan location ^~ /admin/ { allow 172.16.1.0/24; deny all; } #avoid processing of calls to unexisting static files by yii location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { try_files $uri =404; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; try_files $uri index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }
如果我从局域网之外的客户端连接:
2014/10/20 13:04:54 [error] 3794#0: *137 access forbidden by rule, client: 1.2.3.4, server: www.example.tld, request: "GET /admin HTTP/1.1", host: "2.3.4.5"
从内部连接:
2014/10/20 14:29:55 [error] 4165#0: *184 directory index of "/opt/limesurvey/admin/" is forbidden, client: 172.16.1.12, server: www.example.tld, request: "GET /admin/ HTTP/1.1", host: "2.3.4.5"
没有位置的访问日志/ admin {
172.16.1.10 - - [20/Oct/2014:14:32:22 +0200] "GET /admin/ HTTP/1.1" 302 5 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" 172.16.1.10 - - [20/Oct/2014:14:32:22 +0200] "GET /admin/authentication/sa/login HTTP/1.1" 200 4017 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"
Limesurvey调用一个index.php重定位我的请求通过: header( 'Location: ../index.php/admin' ); ../index.php/admin header( 'Location: ../index.php/admin' );
如果您需要更多信息,请询问
提前致谢!
Nginx认为你正在尝试列出目录/opt/limesurvey/admin内容,因为你没有请求任何文件,也没有转发到php后备。
删除服务器级别的try_files指令。 改为添加此位置:
location / { try_files $uri /index.php?$args; }
并将pipe理员位置更改为:
location ^~ /admin/ { allow 172.16.1.0/24; deny all; try_files $uri /index.php?$args; }