Comments (9)
location / {
try_files $uri $uri/ @kohana;
}
location @kohana {
rewrite ^/(.+)$ /index.php$request_uri last;
}
在你的场景中,因为您安装到了非根,需要将上面的 /index.php 改成对应位置,并且可能需要修改一下 OJ 配置中的 base。
Regards,
Jason Lau
from hustoj.
谢谢你的回复,但是在实际的配置中我确实还是存在问题。所以我想再次确认一下。
首先、我的web目录是/var/www/html
OJ所在目录为/var/www/html/OJ
我的'base_url' => '/OJ/', // should ends with /, for example '/oj/'
//设置为其他就我不能访问OJ主页了。
nginx.conf
location / {
try_files $uri $uri/ @kohana;
}
location @kohana {
rewrite ^/(.+)$ /index.php$request_uri last;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/?.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
那么我的base_url还要修改么?
/index.php呢,修改为/var/www/html/OJ/index.php等尝试都进入不了。
http://115.28.54.193/OJ/index.php/status
直接访问是可以的。
from hustoj.
不清楚 nginx 非根如何配置的,HUSTOJ 这里的配置没有问题。
你需要将 http://115.28.54.193/OJ/status/ 配置为导向 http://115.28.54.193/OJ/index.php/status/
如果是在根下,只需要按照我提供的 nginx 配置文件。
from hustoj.
Thank you helping me solve the problem above.
I change the rewrite in location @kohana to
rewrite ^(/\w+)/(.+)$ $1/index.php/$2$query_string last;
Now I can access every page but another problem arises. I can't login.
I use $query_string and $args, but nothing happens.
I access to the rewrite_log and can't Find any $args in it.
I press F12 when login and I find the post information.
If you can provide any other Information or the configure about php in nginx or the URI to login, it would be better.
eg. http://115.28.54.193/OJ/user/login?userName=xxx&pw=xxx
or http://115.28.54.193/OJ/user/login/name/pw
or http://115.28.54.193/OJ/user/login/pw/name
或者我想应该是post后台的变量名不一致导致的吧,看来只能尝试读源码了。。。。
谢谢了。
from hustoj.
Login 是 POST 的不是 GET 的。
请描述一下情况,发一下 PHP 日志?
from hustoj.
nginx的log如下:
error.log:
2015/12/26 18:30:58 [notice] 13855#0: *16871 "^(/\w+)/(.+)$" matches "/OJ/user/login", client: 218.205.20.61, server: localhost, request: "POST /OJ/user/login HTTP/1.1", host: "115.28.54.193", referrer: "http://115.28.54.193/OJ/user/login"
2015/12/26 18:30:58 [notice] 13855#0: *16871 rewritten data: "/OJ/index.php/user/login", args: "", client: 218.205.20.61, server: localhost, request: "POST /OJ/user/login HTTP/1.1", host: "115.28.54.193", referrer: "http://115.28.54.193/OJ/user/login"
access.log:
218.205.20.61 - - [26/Dec/2015:18:30:58 +0800] "POST /OJ/user/login HTTP/1.1" 302 5 username=test&pwd=test "http://115.28.54.193/OJ/user/login" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36" -
218.205.20.61 - - [26/Dec/2015:18:30:58 +0800] "GET /OJ/ HTTP/1.1" 200 4899 - "http://115.28.54.193/OJ/user/login" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36" -
如上,access日志格式为
$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" "$http_user_agent" $http_x_forwarded_for
可以看到post参数。
PHP中没有错误日志,PHP-FPM的日志无关。
from hustoj.
表现为无错误,但没有登录成功?
你可以检查并尝试清空 Cookie。
from hustoj.
最终还是没能解决,表现为无错误。如果密码正确会跳转到首页,但是表现为无登录状态,如果密码错误依然会留在登录页。难道是登录后的信息没有存在session里?不懂php,如果找不到解决方案,只能放假回去边学边看了。
from hustoj.
我之前遇到过这个问题,是因为 session 和 cookie 没有配置清楚。但是具体原因我已经忘记了,抱歉。
你可以检查一遍配置完整,Cookie 正确写入,并且浏览器清空了原有的带有 Session 信息的 Cookie。
如果仍需要帮助,请再 open 这一 issue。
from hustoj.
Related Issues (18)
- Table 'jol.options' doesn't exist, migrating from Google Code version HOT 1
- Columns missing from Google Code version. HOT 2
- reCAPTCHA key should be in `options` table HOT 1
- Hardcoded href for navbar, base.php:base_url should be used HOT 4
- edit user permission HOT 1
- user session update HOT 2
- Status code 13 not available, migrating from Google Code version
- Installation HOT 17
- 貌似http://acm.hust.edu.cn/status 10月23日一直卡 HOT 1
- Installation HOT 1
- I can not login HOT 2
- Installation problem HOT 3
- It stopped on this pending results HOT 3
- SYSPATH/classes/Kohana/Kohana/Exception.php [ 84 ] HOT 4
- ErrorException [ Fatal Error ]: Call to undefined function __() HOT 2
- APPPATH/classes/OJ.php [ 10 ] HOT 3
- Error with rewrite! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hustoj.