功能介绍php
登陆事后会在redis中存储一条键名为:insidetoken-41a6e5b9-a086-48a8-9b85-49d0f78685bc
以insidetoken-开头的记录,内部的值为通过序列化的用户信息。css
而且在配置的域名中生成一条token=insidetoken-41a6e5b9-a086-48a8-9b85-49d0f78685bc
的cookiehtml
使用者可在各个系统获取浏览器以及其余设备发送给服务器的cookie进行redis中匹配来判断用户是否处于登陆状态。mysql
目录结构介绍nginx
backend(前台界面目录)git
frontend(后端PHP目录)github
配置并使用redis
进入backend目录 执行 composer install
sql
系统token存储于redis,请确保redis server开启并处于可用状态数据库
数据库存储使用mysql server,请导入backend/database/sql/insideaccount_user.sql
配置.env 文件,修改DOMAIN=hb.com为你本身的域名
增长nginx配置,以下所示:
{
listen 80;
server_name insideaccount.hb.com;
root /Users/laolu/www/haibao-php-insideaccount/frontend/;
index index.html;
location ~ .*/.(css|js)$ {
add_header Cache-Control 'no-store';
}
location /backend/ {
proxy_pass http://127.0.0.1:9191/; proxy_set_header X-real-IP $remote_addr; proxy_set_header Host $host; proxy_redirect off;
}
}
{
listen 9191;
root /Users/laolu/www/haibao-php-insideaccount/backend/public;
index index.php;
try_files $uri $uri/ /index.php?query_string;
location ~ .php {
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;
}
}
预览