Shiny-server installation: Server not responding on port 3838 - r

I installed the shiny-server on a Ubuntu 16.04.1 and according to the console output it is active and running:
systemctl status shiny-server
● shiny-server.service - ShinyServer
Loaded: loaded (/etc/systemd/system/shiny-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2016-08-24 18:17:09 CEST; 15h ago
Process: 13175 ExecStartPost=/bin/sleep 3 (code=exited, status=0/SUCCESS)
Main PID: 13179 (shiny-server)
Tasks: 7
Memory: 28.5M
CPU: 158ms
CGroup: /system.slice/shiny-server.service
├─13174 /bin/bash -c /opt/shiny-server/bin/shiny-server --pidfile=/var/run/shiny-server.p
└─13179 /opt/shiny-server/ext/node/bin/shiny-server /opt/shiny-server/lib/main.js --pidfi
lines 1-11/11 (END)
Then I opened the port 3838 as stated in the installation guide:
netstat -ntlp | grep LISTEN
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3838 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
3838/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
3838/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
Howevever if I try to access my server over the port 3838 in a browser, I don't get any response from the server and the site stays blank and eventually times out.
Any ideas what I might be missing?

Apparently there was some problem with the port 3838 on my server. Although the console output above states that it is open and listed as "LISTEN", it still didn't work. When I changed the default port for my shiny-server in the configuration file (/etc/shiny-server/shiny-server.conf) to 80, it suddently worked:
# Define a top-level server which will listen on a port
server {
# Instruct this server to listen on port 3838
listen 80;
...

Related

Mosquitto: Starting in local only mode but can't fix

My Rpi4 running my home automation recently upgraded itself from mosquitto version 1.6.12 to 2.0.8 and as a consequence it was starting in local only mode.
Done some digging about but still can't get it all working again, mainly used this previous helpful question Mosquitto: Starting in local only mode but my devices still can't connect.
From my mosquiito log I see
1614386087: mosquitto version 2.0.8 starting
1614386087: Config loaded from /etc/mosquitto/mosquitto.conf.
1614386087: Opening ipv4 listen socket on port 1883.
1614386087: Opening ipv6 listen socket on port 1883.
1614386087: mosquitto version 2.0.8 running
The service shows this
:~$ sudo systemctl status mosquitto
* mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-02-27 00:34:47 GMT; 10h ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 375 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 398 ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 404 ExecStartPre=/bin/mkdir -m 740 -p /var/run/mosquitto (code=exited, status=0/SUCCESS)
Process: 411 ExecStartPre=/bin/chown mosquitto: /var/run/mosquitto (code=exited, status=0/SUCCESS)
Main PID: 419 (mosquitto)
Memory: 1.5M
CGroup: /system.slice/mosquitto.service
`-419 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Feb 27 00:34:47 Vero4K systemd[1]: Starting Mosquitto MQTT Broker...
Feb 27 00:34:47 Vero4K mosquitto[419]: 1614386087: Loading config file /etc/mosquitto/conf.d/calz.conf
Feb 27 00:34:47 Vero4K systemd[1]: Started Mosquitto MQTT Broker.
In my calz.conf file I have
listener 1883
allow_anonymous true
But my local version of Domoticz (runs on the same box) shows this in it's logs
Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to '127.0.0.1:1883'
Error: (ShellyMQTT) Failed to connect to: 127.0.0.1:1883, Description: resolve: Host not found (authoritative)
And all my Tasmota devices now show
14:49:38 MQT: Attempting connection...
14:49:38 MQT: Connect failed to 192.168.1.19:1883, rc -2. Retry in 120 sec
I can see the port open as well
sudo netstat -tulpn | grep LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 361/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 729/sshd
tcp 0 0 0.0.0.0:37015 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:36666 0.0.0.0:* LISTEN 608/kodi.bin
tcp 0 0 0.0.0.0:36667 0.0.0.0:* LISTEN 608/kodi.bin
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 375/mosquitto
tcp 0 0 0.0.0.0:49472 0.0.0.0:* LISTEN 763/rpc.statd
tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN 608/kodi.bin
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/init
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 608/kodi.bin
tcp6 0 0 :::22 :::* LISTEN 729/sshd
tcp6 0 0 :::49079 :::* LISTEN 763/rpc.statd
tcp6 0 0 :::36666 :::* LISTEN 608/kodi.bin
tcp6 0 0 :::36667 :::* LISTEN 608/kodi.bin
tcp6 0 0 :::1883 :::* LISTEN 375/mosquitto
tcp6 0 0 :::49919 :::* LISTEN -
tcp6 0 0 :::9090 :::* LISTEN 608/kodi.bin
tcp6 0 0 :::111 :::* LISTEN 1/init
tcp6 0 0 :::8080 :::* LISTEN 608/kodi.bin
/etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
Any ideas?
Your problem is not that Mosquitto is not listening, it's that your devices are trying to resolve a hostname of 127.0.0.1:1883
I suspect you have entered the host:port combination into fields that should
Only contain a hostname/IP address
You probably should NOT be entering 127.0.0.1 as this always points to the device it is entered on and you should be entering the IP address the broker is actually running on.
Think I sorted it in the end, bizarre combination of things...
Updating Mosquito required the listener port and anonymous part but for some reason my Raspberry Pi on reboot had switch across to an guest network and gained a new IP so nothing was ever going to get to it :(
I realised when the port was listening and couldn't get to it then the same for everything else like kodi, ssh etc. I happened to be on the console for it as it was more convenient at the time, If I had tried to SSH to it that would of failed too.

NGINX Amazon EC2 keeps loading through 80 port is allowed

I'm trying to host ubuntu 18.4 server on aws ec2 instance.
]
Though I've allowed 80 port but when i tryto see on browser using my public ip it wont loading but it suppose to show nginx welcome screen.
netstat -tuanp | grep 80
output
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 16912/nginx: master
tcp6 0 0 :::80 :::* LISTEN 16912/nginx: master
My nginx is running perfectly . Here is the status
My browser showing:
This site can’t be reached my_public_ip took too long to respond.
Please Help!

502 Bad Gateway Nginx+Flask+Gunicorn (2: No such file or directory)

I am trying to connect my flask app to Nginx and Gunicorn, based on this tutorial: How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 14.04.
I am getting a 502 Bad Gateway
var/log/nginx
2017/10/16 21:17:04 [crit] 11284#0: *8 connect() to unix:/home/myproject/myproject.sock failed (2: No such file or directory) while connecting to upstream, client: <myIP>, server: <myIP>, request: "GET / HTTP/1.1", upstream: "http://unix:/home/myproject/myproject.sock:/", host: "<myIP>"
It seems like Nginx couldn't find the myproject.sock file, and I don't know why my upstart script wouldn't create one based on the tutorial. Any guidance is greatly appreciated.
Below are my files:
/home/myproject/myproject.py
from flask import Flask
application = Flask(__name__)
#application.route("/")
def hello():
return "<h1 style='color:blue'>Hello There!</h1>"
if __name__ == "__main__":
application.run(host='0.0.0.0')
/home/myproject/wsgi.py
from myproject import application
if __name__ == "__main__":
application.run()
/etc/init/myproject.conf
note: I ran the cd and exec command in the file below for testing purposes and it works fine.
description "Gunicorn application server running myproject"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid www-data
setgid www-data
script
cd /home/myproject
exec gunicorn --bind unix:myproject.sock -m 007 wsgi
end script
/etc/nginx/sites-available this is symlinked to sites-enabled
server {
listen 80;
server_name <myIPaddressHere>;
location / {
include proxy_params;
proxy_pass http://unix:/home/myproject/myproject.sock;
}
}
Debugging Steps I took:
(1) I checked that the upstart script is running
$ sudo status myproject
myproject start/running, process 22476
(2) Nginx is running
(3) Weird, I don't see my myproject.sock
# netstat -lpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 11279/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1304/sshd
tcp6 0 0 :::80 :::* LISTEN 11279/nginx
tcp6 0 0 :::22 :::* LISTEN 1304/sshd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] SEQPACKET LISTENING 7190 386/systemd-udevd /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 8774 1120/acpid /var/run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 6541 1/init #/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 8339 859/dbus-daemon /var/run/dbus/system_bus_socket
[Solved] A mentor of mine pointed this out.
www-data/www-data can not write to /home/myproject/
Either write into tmp or choose a user/group that has more permissions.
I chose to write to /tmp
description "Gunicorn application server running myproject"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid www-data
setgid www-data
script
cd /home/myproject
exec gunicorn --bind unix:/tmp/myproject.sock -m 007 wsgi
end script
And the Nginx file looks like this:
server {
listen 80;
server_name <ip>;
location / {
include proxy_params;
proxy_pass http://unix:/tmp/myproject.sock;
}
}

How to disable FTP port (Debian)?

I am newbie in Debian. I have open FTP port (21) on Debian 6 (http server of the system is Nginx). How I can stop or disable the port via service or somehow yet? The command /etc/init.d/proftpd stop is not working, it shows in console bash: /etc/init.d/proftpd: No such file or directory because proftpd is absent.
Inputing this command netstat -tnlp, you can find which process is running on port 21.
Then you can some work by youself.
If you are to lazy to stop the service from running you can write an iptables rule
sbin/iptables -A INPUT -p tcp --destination-port {PORT-NUMBER-HERE} -j DROP
Start by checking if your port is listening
sudo ss -tulnp | grep LISTEN
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 5 127.0.0.1:29754 0.0.0.0:* users:(("vpnagentd",pid=960,fd=4))
tcp LISTEN 0 128 0.0.0.0:17500 0.0.0.0:* users:(("dropbox",pid=3129583,fd=48))
tcp LISTEN 0 50 0.0.0.0:445 0.0.0.0:* users:(("smbd",pid=923696,fd=48))
tcp LISTEN 0 128 127.0.0.1:17600 0.0.0.0:* users:(("dropbox",pid=3129583,fd=67))
tcp LISTEN 0 128 127.0.0.1:17603 0.0.0.0:* users:(("dropbox",pid=3129583,fd=75))
tcp LISTEN 0 50 0.0.0.0:139 0.0.0.0:* users:(("smbd",pid=923696,fd=49))
tcp LISTEN 0 32 0.0.0.0:53 0.0.0.0:* users:(("dnsmasq",pid=1276,fd=7))
tcp LISTEN 0 32 0.0.0.0:21 0.0.0.0:* users:(("vsftpd",pid=1230,fd=3))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=43857,fd=3))
tcp LISTEN 0 128 127.0.0.1:631 0.0.0.0:* users:(("cupsd",pid=3138801,fd=7))
tcp LISTEN 0 128 [::]:17500 [::]:* users:(("dropbox",pid=3129583,fd=47))
tcp LISTEN 0 2 *:3389 *:* users:(("xrdp",pid=1306,fd=11))
tcp LISTEN 0 50 [::]:445 [::]:* users:(("smbd",pid=923696,fd=46))
tcp LISTEN 0 50 [::]:139 [::]:* users:(("smbd",pid=923696,fd=47))
tcp LISTEN 0 32 [::]:53 [::]:* users:(("dnsmasq",pid=1276,fd=9))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=43857,fd=4))
tcp LISTEN 0 2 [::1]:3350 [::]:* users:(("xrdp-sesman",pid=1295,fd=7))
tcp LISTEN 0 128 [::1]:631 [::]:* users:(("cupsd",pid=3138801,fd=6))
So, you see in port 21 you have service vsftpd listening.
You can check the status:
sudo service vsftpd status
● vsftpd.service - vsftpd FTP server
Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-07-19 09:42:45 EDT; 2 months 15 days ago
Main PID: 1230 (vsftpd)
Tasks: 1 (limit: 38363)
Memory: 972.0K
CPU: 7ms
CGroup: /system.slice/vsftpd.service
└─1230 /usr/sbin/vsftpd /etc/vsftpd.conf
Now, you can block the port with the firewall (for example you can use ufw), or stop the service
$ sudo service vsftpd stop
$ sudo service vsftpd status
● vsftpd.service - vsftpd FTP server
Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2022-10-03 10:55:50 EDT; 9s ago
Process: 1230 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=killed, signal=TERM)
Main PID: 1230 (code=killed, signal=TERM)
CPU: 7ms
Oct 03 10:55:50 Tuxy systemd[1]: Stopping vsftpd FTP server...
Oct 03 10:55:50 Tuxy systemd[1]: vsftpd.service: Succeeded.
Oct 03 10:55:50 Tuxy systemd[1]: Stopped vsftpd FTP server.
So, in summary. Install ufw. Unblock only ports you are going to use (ssh, etc). Start only the services you are going to use. (sudo service *** start/stop)
good luck

Apache2 won't start after removing nginx

I stop nginx, removed it, rebooted, installed Apache2 and reinstalled php5-fpm.
Now when I try to start Apache I get this error:
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
When I run a netstat I see this:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1613/nginx
tcp6 0 0 :::8080 :::* LISTEN 1850/java
tcp6 0 0 :::80 :::* LISTEN 1613/nginx
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 1850/java
After I removed Nginx I did a purge as well.
Can someone tell me how to remove these remaining remnants so I can start
Apache2? Also - I can't figure out what is serving my web page…lol..but the site is up.
Thank you for any help!
Tri
php5-fpm is only relevant if you're running nginx. If you want to run apache instead, stop and remove php5-fpm. Also, make sure php is compiled --with-apache and not --with-fpm. When running apache with php, also make sure the libphp5.so module is loaded in httpd.conf.

Resources