dongrao1862 2014-09-22 19:12
浏览 32
已采纳

nginx安装后无法登录我网站的UI

so there is my problem: I've switched from apache to nginx, installed php-fpm and everything seems to be okay except one thing - I can no longer login through my webpage login form. I mean - when i type wrong credentials - It fetches and says "Bad details". But when I try to login with good details - page just refreshes without any sign. nginx error log doesn't show anything special, same as php-fpm log.

This is my nginx.conf:

worker_processes  6;

events {
worker_connections    1000;
}

http {
include       mime.types;
default_type  application/octet-stream;
types_hash_bucket_size 64;
server_names_hash_bucket_size 128;

sendfile        off;
tcp_nopush     on;

keepalive_timeout  4;


server {
    listen       80;
     root /usr/share/nginx/html;
    server_name  diamond-ptp.com;
    index index.php index.html;
 location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }


  location ~ \.php$ {
      try_files $uri $uri/ $uri/login.php /login.php;
       fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
         include /etc/nginx/fastcgi_params;
    }

}

There is my phpinfo(); : http://diamond-ptp.com/info.php

It's writter there: _SERVER["REQUEST_METHOD"] GET , shouldn't it be POST if I use post method in my login form?

So I wonder maybe it's something $_POST related? Because overall PHP works good. Or maybe something with caching? Anyone has suggestions?

  • 写回答

2条回答 默认 最新

  • dongmengan8620 2014-09-22 19:33
    关注

    Moving from comments to here, make sure to check your session folder. By default, it's normally owned by apache, making logins seemingly "fail".

    To fix this, you'll want to re-own your sessions folder, running something like this (via sudo, normally):

    chown -R user:nginx /var/lib/php/session
    

    You'll want to replace that path (/var/lib/php) with your distro's session path, and the user (user in user:nginx) with the proper user (usually root)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致