Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.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/5/date/2.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
Mongodb Can';t从外部连接到mongo_Mongodb_Debian - Fatal编程技术网

Mongodb Can';t从外部连接到mongo

Mongodb Can';t从外部连接到mongo,mongodb,debian,Mongodb,Debian,你好,我正在尝试部署我的第一个MEAN应用程序 除了在本地主机上,所有都可以工作 从外面我可以看到前端(angular2) 我的问题是我无法从外部登录我的应用程序。当我试图创建帐户或登录存在acc时,我有 错误连接被拒绝 这是我的mongod.conf # mongod.conf # Where to store the data. # Note: if you run mongodb as a non-root user (recommended) you may # need to cr

你好,我正在尝试部署我的第一个MEAN应用程序

除了在本地主机上,所有都可以工作

从外面我可以看到前端(angular2)

我的问题是我无法从外部登录我的应用程序。当我试图创建帐户或登录存在acc时,我有

错误连接被拒绝

这是我的mongod.conf

# mongod.conf

# Where to store the data.

# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb

#where to log
logpath=/var/log/mongodb/mongod.log

logappend=true
smallfiles=true

port = 27017

# Listen to local interface only. Comment out to listen on all interfaces. 
bind_ip = 127.0.0.1

# Disables write-ahead journaling
# nojournal = true

# Enables periodic logging of CPU utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true
#auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#diaglog = 0

# Ignore query hints
#nohints = true

# Enable the HTTP interface (Defaults to port 28017).
#httpinterface = true

# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true

# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true

# Disable data file preallocation.
#noprealloc = true

# Specify .ns file size for new databases.
# nssize = <size>

# Replication Options

# in replicated mongo databases, specify the replica set name here
#replSet=setname
# maximum size in megabytes for replication operation log
#oplogSize=1024
# path to a key file storing authentication info for connections
# between replica set members
#keyFile=/path/to/keyfile

我正在使用debian jessie

根据您的描述,您的MongoDB似乎没有部署在本地主机上。如果是这种情况,您需要更新配置

请注意bind_ip参数()。如果你在不同的服务器上部署你的应用,mongodb服务器公共IP应该在这里。应用程序连接字符串也需要更新以反映正确的IP


但请确保在公开部署时正确设置了安全选项(至少是身份验证)

我已经在我的debian服务器上安装了mongodb,其中还有节点等。我正在使用nginx。我可以从外部看到我的前端,但当我尝试登录时,我收到错误conn REFERED。您能否提供更多详细信息,您所说的部署是什么意思?改变了什么?您还可以提供您的nginx配置吗?
{
    "connectionString": "mongodb://127.0.0.1:27017/mydb",
    "apiUrl": "http://localhost:4000",
    "secret": "REPLACE THIS WITH YOUR OWN SECRET, IT CAN BE ANY STRING"
}