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


After nginx installation cannot login in to my site's UI

所以我有问题:我从apache切换到nginx,安装了php-fpm,除了一件事之外,一切似乎都很好-我不能再通过网页登录表单登录了。我的意思是-当我键入错误的凭据时-它会获取并显示"错误的详细信息"。但当我尝试使用良好的详细信息登录时,页面只是在没有任何符号的情况下刷新。nginx错误日志并没有显示任何特别的内容,与php-fpm日志相同。

这是我的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;
    }
}

这里有我的phpinfo();:http://diamond-ptp.com/info.php

上面写着:_SERVER["REQUEST_METHOD"]GET,如果我在登录表单中使用POST方法,它不应该是POST吗?

所以我想知道它可能与$_POST有关?因为总体来说PHP运行良好。或者可能是有缓存的东西?有人有什么建议吗?

从注释移到此处,请确保检查您的session文件夹。默认情况下,它通常由apache所有,这使得登录看起来"失败"。

要解决此问题,您需要重新拥有会话文件夹,运行类似的程序(通常通过sudo):

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

您需要将该路径(/var/lib/php)替换为发行版的会话路径,并将用户(user:nginx中的user)替换为正确的用户(通常为root

存在权限问题:

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

这个命令成功了,帮助了我!