passenger 5.1.11更新,节点socket.io错误
passenger 5.1.11 update, node socket.io error
从 passenger 1:5.1.5-1~jessie1 更新到这个新版本后。我们在浏览器中收到以下错误:
Failed to load
https://aaa.bbb.com/socket.io/?hash=1735f35ec0ad4e4d91618861288467ed&EIO=3&transport=polling&t=LzIr1i8:
No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'https://aaa.bbb.com' is therefore not allowed
access. The response had HTTP status code 404.
nginx 错误日志:
2017/10/25 11:42:24 [error] 638#638: *20
"/export/home/aaa.bbb.com/public/socket.io/index.html" is not found
(2: No such file or directory), client: 111.111.111.111, server:
aaa.bbb.com, request: "GET
/socket.io/?hash=1735f35ec0ad4e4d91618861288467ed&EIO=3&transport=polling&t=LzIwLNC
HTTP/1.1", host: "aaa.bbb.com", referrer:
"https://ccc.bbb.com/mmmm/zzzz/"
如您所见,我们正在使用 socket.io (1.5.1)。我们的 socket.io 服务器安装了 node.js (v6.11.5) 和 passenger (5.1.11)。
我们以前从未需要设置原点。 Web 服务器和套接字服务器都在同一个域中,只是不同的子域。
但 nginx 日志中的错误可能才是真正的问题。
编辑
我已将客户端和服务器端的 socket.io 更新到版本 2.0.4。但是我运行还是陷入同样的错误
编辑 2
乘客在启动时坠毁。可能是权限问题。
2017/10/25 16:15:59 [info] 315#315: Using 32768KiB of shared memory
for nchan in /etc/nginx/nginx.conf:84 [ N 2017-10-25 16:15:59.9486
612/T1 age/Wat/WatchdogMain.cpp:1267 ]: Starting Passenger watchdog...
[ E 2017-10-25 16:15:59.9993 617/T1 age/Sha/Fun/Initialization.cpp:569
]: * ERROR: Cannot open /var/log/nginx/error.log for writing:
Permission denied (errno=13)
in 'Passenger::VariantMap Passenger::Agent::Fundamentals::initializeAgent(int, char*, const
char*, Passenger::Agent::Fundamentals::OptionParserFunc,
Passenger::Agent::Fundamentals::PreinitializationFunc, int)'
(Initialization.cpp:538)
2017/10/25 16:15:59 [alert] 609#609: Unable to start the Phusion
Passenger watchdog because it encountered the following error during
startup: Unable to start the Passenger core: it seems to have crashed
during startup for an unknown reason, with exit code 1 (-1: Unknown
error)
在更新之前,我将 passenger_user_switching 设置为关闭。这使得乘客进程自动 运行 为 nobody:noboby
passenger_user_switching off;
更新后,我将 passenger_user 和 passenger_group 明确设置为 运行 作为 nobody:noboby(默认 passenger_user_switching 开启)
# passenger_user_switching off;
passenger_user nobody;
passenger_group nobody;
从 passenger 1:5.1.5-1~jessie1 更新到这个新版本后。我们在浏览器中收到以下错误:
Failed to load https://aaa.bbb.com/socket.io/?hash=1735f35ec0ad4e4d91618861288467ed&EIO=3&transport=polling&t=LzIr1i8: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://aaa.bbb.com' is therefore not allowed access. The response had HTTP status code 404.
nginx 错误日志:
2017/10/25 11:42:24 [error] 638#638: *20 "/export/home/aaa.bbb.com/public/socket.io/index.html" is not found (2: No such file or directory), client: 111.111.111.111, server: aaa.bbb.com, request: "GET /socket.io/?hash=1735f35ec0ad4e4d91618861288467ed&EIO=3&transport=polling&t=LzIwLNC HTTP/1.1", host: "aaa.bbb.com", referrer: "https://ccc.bbb.com/mmmm/zzzz/"
如您所见,我们正在使用 socket.io (1.5.1)。我们的 socket.io 服务器安装了 node.js (v6.11.5) 和 passenger (5.1.11)。
我们以前从未需要设置原点。 Web 服务器和套接字服务器都在同一个域中,只是不同的子域。
但 nginx 日志中的错误可能才是真正的问题。
编辑
我已将客户端和服务器端的 socket.io 更新到版本 2.0.4。但是我运行还是陷入同样的错误
编辑 2
乘客在启动时坠毁。可能是权限问题。
2017/10/25 16:15:59 [info] 315#315: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:84 [ N 2017-10-25 16:15:59.9486 612/T1 age/Wat/WatchdogMain.cpp:1267 ]: Starting Passenger watchdog... [ E 2017-10-25 16:15:59.9993 617/T1 age/Sha/Fun/Initialization.cpp:569 ]: * ERROR: Cannot open /var/log/nginx/error.log for writing: Permission denied (errno=13) in 'Passenger::VariantMap Passenger::Agent::Fundamentals::initializeAgent(int, char*, const char*, Passenger::Agent::Fundamentals::OptionParserFunc, Passenger::Agent::Fundamentals::PreinitializationFunc, int)' (Initialization.cpp:538)
2017/10/25 16:15:59 [alert] 609#609: Unable to start the Phusion Passenger watchdog because it encountered the following error during startup: Unable to start the Passenger core: it seems to have crashed during startup for an unknown reason, with exit code 1 (-1: Unknown error)
在更新之前,我将 passenger_user_switching 设置为关闭。这使得乘客进程自动 运行 为 nobody:noboby
passenger_user_switching off;
更新后,我将 passenger_user 和 passenger_group 明确设置为 运行 作为 nobody:noboby(默认 passenger_user_switching 开启)
# passenger_user_switching off;
passenger_user nobody;
passenger_group nobody;