Apache2 won't start after removing nginx - 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.

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.

drive_auth() function not creating gargle-oauth token on password submission

R v3.6.2
RStudio Desktop v1.2.5033
R package 'googledrive' v1.0.0
I have written an R script that uploads csv files to a googlesheets account. In order to avoid having to automate this, I have used the drive_auth() function to refresh the OAuth token. Code is simply:
drive_auth(
email = "email#gmail.com",
path = NULL,
scopes = "https://www.googleapis.com/auth/drive",
cache = gargle::gargle_oauth_cache(),
use_oob = gargle::gargle_oob_default(),
token = NULL
)
drive_upload(file, overwrite=TRUE, type="spreadsheet")
On both a mac and a Windows OS machine, this then opens a default browser that asks for login details. When these are correctly entered, the script now has permissions to upload / edit files and googledrive functions subsequently work. It creates an authority token in the file path:
Home/Users/.R/garle/gargle-oauth
However, when attempting to do this on a new laptop that will be used as a server, I am met with the following error messages:
Error: can't get Google credentials.
Are you running googlesheets in a non-interactive session? Consider:
* sheets_deauth() to prevent the attempt to get credentials.
* call 'sheets_auth()' directly with all necessary specifics.
On inspection of the gargle-oauth folder, it has not created an OAuth token, as it did automatically with other machines on the entering of google login details.
I re-ran the programme on the other windows machine after deleting the OAuth token and it worked fine, creating the token again from scratch. I cannot pinpoint the reason why this token is not being created in this instance.
I've since solved this and I'm going to post an answer in case anyone is in a similar problem and comes across this post during a google search.
When initialising a connection with googledrive, the package uses the default port of 1410. It was unable to establish a connection with google because a zombie process was using this port.
To kill this process, open up the windows command prompt (or command line on a mac) as admin and enter the netstat command:
C:\Users>netstat -ano|findstr "PID :1410"
This will (if anything is running on this port) return:
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:1410.0.0.0:0 LISTENING 18264
That number at the bottom right is the process PID, enter that into the following command to kill the process:
taskkill /pid 18264 /f
When running any R googledrive functions, you should now be able to authorise your code to interact with your google account and it will create an OAuth token to save you having to go through this again.
I confirm that this problem also got me on Ubuntu. I resolved it by finding and killing the process on port 1410 (which was also listening on 40167):
me#me:/internal$ netstat -tulpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 894/node
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:1410 0.0.0.0:* LISTEN 21011/R
tcp 0 0 127.0.0.1:40197 0.0.0.0:* LISTEN 21011/R
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::25 :::* LISTEN -
tcp6 0 0 :::443 :::* LISTEN -
tcp6 0 0 :::1917 :::* LISTEN 1277/node /home/ult
tcp6 0 0 :::3838 :::* LISTEN -
tcp6 0 0 ::1:6379 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
udp 0 0 127.0.0.53:53 0.0.0.0:* -
me#me:/internal$ kill -HUP 21011

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!

Apache Zeppelin only listening on tcp6

Because I have just started with Zeppelin, I am a bit lost.
I installed via this page: http://zeppelin.apache.org/docs/0.7.3/install/install.html
After installation Zeppelin appears to only listen on the tcp6 address on port 8080:
ubuntu#ip-10-0-1-164:~$ sudo netstat -lnp
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:22 0.0.0.0:*
LISTEN 1176/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:*
LISTEN 1203/mysqld
tcp6 0 0 :::8080 :::*
LISTEN 13719/java
tcp6 0 0 :::22 :::*
LISTEN 1176/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:*
1028/dhclient
I grepped all the installation files and didn't see where it was getting direction for the IP and port (other than template files in conf).
I was wondering if anyone had some more knowledge of Zeppelin.
It's very simple.
Remove ".template" from file name "zeppelin-site.xml.template"
Change port in "zeppelin.server.port"
Restart Zeppelin
Go to localhost:new_port in browser.
Actually, it was fine. It is listening on tcp4 even though it's not showing. The issue was with my SSH port forwarding.

Has anyone seen https suddenly stop working?

My webserver has been working for years. It suddenly stopped working today -- in https. I'm running Ubuntu 14.04.5 and serving pages through nginx.
When I receive an http request on port 80, it shows up in the access logs and is handled correctly. When I receive an https request on port 443, it never shows up in the nginx logs and never gets forwarded on to my django webserver.
I can telnet to port 80 but get timeouts on 443. (I never tried that before, so I don't know if it's new.)
My ports are open properly.
~ $ sudo netstat -ntlp | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1285/nginx
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1285/nginx
tcp6 0 0 :::80 :::* LISTEN 1285/nginx
Could it be related to tcp vs tcp6? Only plain tcp is on 443, but they're both on 80. If so, how would I change that? And what would cause a sudden change?
I'm not running a firewall. I double checked, and ufw status is inactive.
Thanks in advance!
A I solved it. All my servers are in the AWS cloud, and I have a security group that says only specified IPs are allowed to ssh in. When I added a new IP that could ssh in, I accidentally deleted the row that said anyone could connect via https on 443. Sigh.

Resources