我在使用 tank auth 时遇到了一些困难(在 Codeigniter 中)。
我们将它设置在 NGINX 之上,并且在大多数情况下它似乎工作正常。我刚刚“安装”了 Tank_Auth 库,但它不起作用。
在注册页面上,我故意输入错误信息,页面似乎只是刷新并返回到空表单。
查看 Chrome 开发工具中的网络选项卡,它看起来像是试图发布到正确的控制器,但它抛出了 404。这让我相信 NGINX conf 存在问题,基于一些奇怪的重写/位置工作。
我对这些 conf 文件没有经验,所以我有点不知所措。
下面是请求的输出,然后是我的 NGINX conf:
Request URL:http://localhost:8080/auth/register
Request Method:POST
Status Code:404 Not Found
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:104
Content-Type:application/x-www-form-urlencoded
Cookie:ci_session=Ive hidden this
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/auth/register
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
Form Dataview sourceview URL encoded
username:sfjskl
email:kldsjfkljkljdsfklj
password:klfjdskljklvdjlk
confirm_password:js
register:Register
Response Headersview source
Connection:close
Content-Type:text/html
Date:Thu, 27 Jun 2013 08:48:35 GMT
Server:nginx/1.4.1
Transfer-Encoding:chunked
X-Powered-By:PHP/5.4.15
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 8080;
server_name myservername;
# catch all
error_page 404 /index.php;
location / {
root html;
index index.php index.html index.htm;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
include fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass myservername:9000;
}
}
}