Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 节点(keystonejs)地址已在使用中错误,但不是。还有一个错误。NGINX后面_Javascript_Linux_Node.js_Nginx_Keystonejs - Fatal编程技术网

Javascript 节点(keystonejs)地址已在使用中错误,但不是。还有一个错误。NGINX后面

Javascript 节点(keystonejs)地址已在使用中错误,但不是。还有一个错误。NGINX后面,javascript,linux,node.js,nginx,keystonejs,Javascript,Linux,Node.js,Nginx,Keystonejs,项目有一个节点CMS 突然(可能是在尝试安装SSL证书后,停止并再次启动节点服务器和nginx)它停止工作 当我在没有root用户的情况下尝试节点keystone.js时,出现以下错误: Error: listen EACCES at errnoException (net.js:901:11) at Server._listen2 (net.js:1020:19) at listen (net.js:1061:10) at net.js:1143:9 at dns.js:72:18 at pr

项目有一个节点CMS

突然(可能是在尝试安装SSL证书后,停止并再次启动节点服务器和nginx)它停止工作

当我在没有root用户的情况下尝试
节点keystone.js
时,出现以下错误:

Error: listen EACCES
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1020:19)
at listen (net.js:1061:10)
at net.js:1143:9
at dns.js:72:18
at process._tickCallback (node.js:415:13)
当您尝试执行此操作时,会出现此错误,但
:3000
未执行此操作

如果端口处于打开状态,也将选中:

root@localhost:/home# sudo ufw status | grep 3000
3000                       ALLOW       Anywhere
3000 (v6)                  ALLOW       Anywhere (v6)
我键入了
ps aux | grep node
,检查服务器上是否有node/nodemon/forever任务运行。只有一个正在运行的节点与此项目无关

root@localhost:/home# ps aux | grep node
server   30637  0.0  0.3 673840 25588 ?        Ssl  11:15   0:00 /usr/bin/nodejs /usr/lib/node_modules/forever/bin/monitor keystone.js
server   30639  0.1  1.9 994280 156736 ?       Sl   11:15   0:06 /usr/bin/nodejs /home/server/my-other-project/keystone.js
root     31503  0.0  0.0  11716   932 pts/1    S+   12:28   0:00 grep --color=auto node
最后我想,
EADDRINUSE
错误可能与服务器后面的
nginx
端口有关(我将端口
80
重定向到
3000
),我检查是否有什么东西阻塞了该端口:

root@localhost:/home/# netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*                 LISTEN      31266/nginx     
tcp6       0      0 :::80                   :::*                    LISTEN      31266/nginx  

您知道为什么会发生这种情况吗?

首先,默认情况下Keystone.JS使用3001作为https,因此您应该检查此端口上是否有内容

但我想问题是,您正在同一端口上启动http和https服务器。 要仅使用https,请在选项中指定:

...
'ssl' : 'only',
...
如果要同时使用两个服务器(http和https),最好同时指定两个端口:

...
'ssl' : true, // launch http and https
'port' : 3000, // for http
'ssl port' : 3001 // for https
'ssl key' : 'your key.pem',
'ssl cert' : 'your cert.crt',
...
我猜您正在执行下面的配置,您将得到错误,因为默认情况下keystone http在3000上启动,您在3000上映射https,但没有说明如何使用http:

...
'ssl' : true, // launch http and https
'ssl port' : 3000, // you launch https on the default http port and do not specify the http port -> error : 'Please check you are not already running a server on the specified port.'
'ssl key' : 'your key.pem',
'ssl cert' : 'your cert.crt',
...

以下是文档:

您得出了一些无根据的结论:>>当您尝试在<1024的端口上启动节点时,会出现此错误,但事实并非如此,因为我在端口3000上有此错误。>>使用netstat-lntu,我检查了哪些端口正在使用,但:3000没有。