Cookie存在问题。我有一个电池电量不好的ARM设备 - 所以在这个设备上的时间可能是错误的 - 它可能是在未来或过去。 Lighttpd在设备上运行,并且在CodeIgniter框架(php)上有一个应用程序。为了保存自动化,我使用了一个标准的系统库Sessions和Cookie帮助器。 Cookie的到期时间为2小时。这是我的问题: 当设备在未来,超过2小时,客户端上的Chrome和Firefox无法自动化(他们认为cookie已经过期且无法保存会话),但Opera可以并且运行良好。 您是否知道如何使其独立于服务器和客户端上的时间设置工作?
答案 0 :(得分:0)
听起来您需要将服务器配置为使用网络时间协议。
众所周知,Linux机器无法自行跟踪时间,因此建议您同步NTP服务器的时间。
虽然我对Angstrom并不是特别熟悉,但我相信以下说明应该有效:
在服务器上安装NTP(如果尚未安装):
opkg update
opkg list|grep ntp
opkg install ntp
然后,您需要配置NTP配置文件(位于 /etc/ntp.conf 中)以使用NTP服务器。
找到相关的服务器,我通常使用http://www.pool.ntp.org/en/并选择右侧的时区,您将获得许多可以使用的服务器。
编辑您的 /etc/ntp.conf 文件并添加前缀为server
的服务器地址,以便您的配置文件看起来类似于:
# This is the most basic ntp configuration file
# The driftfile must remain in a place specific to this
# machine - it records the machine specific clock error
driftfile /etc/ntp.drift
logfile /var/log/ntpd.log
# BELOW IS WHERE YOU ADD YOUR SERVER RECORDS #
# NTP Servers for Ireland from www.pool.ntp.org
server server.address.1
server server.address.2
server server.address.3
server server.address.4
# Using local hardware clock as fallback
# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself
# server 127.127.1.0
# fudge 127.127.1.0 stratum 14
# Defining a default security setting
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
启动您的NTP服务,您应该与世界其他地方同步......
systemctl enable ntpdate.service
systemctl enable ntpd.service
答案 1 :(得分:0)
我为解决这个问题做了些什么: 将cookie的expire属性设置为零,但在服务器端保留expire检查。 自动化很有效,cookie不会浪费浏览器存储和会话,这是我在应用程序中设置的时间。