Most of my node apps I have been able to start like this:
server.listen(8080);
Now I am working with a phantomJS script which requires you to pass the host and port when starting the server. I have not been able to even get a simple hello world to work. I have tried to get the host value several different ways:
from a app.js file
var hostname = require(‘os’).hostname().split(‘.’).shift();
from commandline
uname -n
hostname
And starting the server like this:
server.listen(8080,"127.0.0.1");
server.listen(8080,"localhost");
...etc
And the server starts w/o errors, but never responds to http requests. When I remove the host parameter it works fine.
node -v
v0.10.10
Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid
running in an ec2 instance
Any thoughts?
I'm not sure why this works as the host
0.0.0.0
If someone can shed some light I'll be sure to mark as answered, thanks for reading.
Related
I am kinda new to docker and as for my first project I wanted to try and start a searXNG instance on tor. There have been many people who have accomplished that, yet I cannot figure out whats wrong.
I've installed tor, searxng-docker and docker-compose on my raspberry pi (it is running raspberry pi os lite), got the .onion hostname and put it in .env and then, I got the instance running. But when I checked the link, it gave me a 404.
Can anyone help? I would really appreciate that.
The output of sudo docker ps:
The .env file (I've hide my email:
Do you want your server to be only available on Tor as a hidden service?
This is not supported out of the box.
Here some information that should help:
Add http:// in front of your server name in .env: SEARXNG_HOSTNAME=http://gpfo...onion
In Caddyfile, add bind 127.0.0.1 just before line 10 (tls {$SEARXNG_TLS}).
In torrc, but sure to have HiddenServicePort 80 127.0.0.1:80 in addition to HiddenServiceDir.
I have an easy-one here, I'm new using linux to connect to other linux server, the issue is that on a remote server which I can reach from my vpn, I have a GUI running on the port x.x.x.x:6500
I did not have any problem using putty/xshell to make a tunnel to the server and then to see the GUI in my laptop using the localhost:6500.
I'm trying to do the same on my Manjaro VM but I'm having troubles to see the GUI since there. The page says connection refused...
I'm using the following command:
$ ssh -L 6500:127.0.0.1:6500 x.x.x.x -v
Maybe the command is wrong, that's not the correct syntax?
I am trying to setup a redis server following this guide to provide shared sessions for my Elastic Beanstalk.
I've installed redis on a new ec2 instance, and it's working fine, locally. However, when I tried to connect the project from my Beanstalk to my redis server, I am getting a "connection refused" error.
After some poking around, I found out that my redis only listens to local (I think?)
netstat -l
tcp 0 0 localhost:6379 *:* LISTEN
I have already out bind 0.0.0.0 to /etc/redis/6379.conf, but I suspect that redis is not reading the same configuration file.
My questions:
How do I check if my redis server is actually loading the configuration file? I tried typing spam into the file and sudo service redis_6379 restart expecting errors, but redis starts normally.
Is there another way for me to configure redis to listen to all connections from my VPC?
Edit: Found my answer.
To find out what configuration file is loaded: redis-cli -p 6379 info server
There's 2 parts of the configuration file that I need to change, firstly bind 0.0.0.0 and comment the bind 127.0.0.1 that comes after.
On Linux Ubuntu server 20.04 LTS I was running into a similar issue after reboot of the EC2 server, for me what resolved it (my nodeJs app was running as Ubuntu user I needed to make that path available) was to add to the PATH within /etc/crontab by:
sudo nano /etc/crontab and just comment out the original path in there so you can switch back if required (mine was: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ) and replace it with:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/ubuntu/.nvm/versions/node/v12.20.0/bin and that error disappeared for me
I have MongoDB 3.2 installed on my Linux Red Hat server.
I am starting to access it and looking at the mongo Shell instructions.
For a Windows machine, the instructions want me to get to the command prompt and change dirs to the installation directory. The problem is, MongoDB is installed on my web server and not my local windows machine.
Question: does Mongo Shell apply to me then? How do I start using, connecting and accessing Mongo from my Windows and Mac machines?
[Note: I am a traditional MySQL / phpMyAdmin developer looking to advance to MongoDB]
Amendments:
(1) With the help of #AlexBlex I am progressing to trying to connect to my MongoDB on my server from Robomongo on my windows client. I get the following error when trying to setup my connection. I tried the address with just my server ip and with http://{my server ip}. Neither worked. See screen shot of error
(2) This is what I have in my current mongod.conf file:
#port=27017
bind_ip=127.0.0.1
(3) here is what my connection settings look like. Oddly, #AlexBlex's solution below shows an SSH tab on his Mac version. The Windows and Mac versions I just installed lacks that tab.
If you install MongoDB on your local machine, you can use the Mongo shell like below to connect to your remote server
mongo yourserver:27017/database
You will have to configure your Mongo server to allow remote connections. In order to achieve this you need to have the following line in your /etc/mongodb.conf file. You need to replace 10.0.0.2 with the ip address of your client machine.
bind_ip = 127.0.0.1,10.0.0.2
You need either ssh to the server where mongodb is installed, or install mongodb on local machine.
For robomongo to connect to remote host you need to ssh to the server, and check it listens on external interface:
lsof -i | grep 27017
In case it is bound to localhost only, you need to edit a line with bind_ip in /etc/mongodb.conf and restart the service.
I would recommend to keep it listening on the local interface only for security reasons, and use ssh tunnelling to connect:
I found the answer. #ShahNewasKhan is brilliant. See How to connect Robomongo to MongoDB
All you need to do is SSH to server and edit mongod.conf file:
uncomment #port=27017 to port=27017
comment bind_ip=127.0.0.1 to #bind_ip=127.0.0.1
restart mongodb via service mongod restart
Then create a mongo connection via your server ip in the address field and 27017 in the port field
Hope this helps mongo newbies and start-ups like me :) Good luck.
Now I just need to figure out how to make this secure. My concern is that anyone who knows my server ip can hack into my MongoDB
I have a script running smoothly on one server
// create a new UDP server
dgram = require('dgram');
server = dgram.createSocket('udp6');
server.bind(20500,config.server.ip);
on the second server executing the code throws an error: "Error: bind EAFNOSUPPORT"
node version is v0.10.26 on both machines, however the one where it is working is Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-56-virtual x86_64) and the one where it is not working is Ubuntu 12.04.4 LTS (GNU/Linux 2.6.32-312-ec2 x86_64)
so the Kernel versions are quite different. What could possible be a fix to for this error?
I solved this issue by changing to
server = dgram.createSocket('udp4');
and setting my server ip to 0.0.0.0
I was not able to make udp6 work