I migrated my server OS from CentOS 7 to CentOS 8 stream recently with standard installation options. Now I'm facing an error on the HTTP/S server accessing.
Assuming you are running a http server on port 80 or 443. For example using python module http.server
:
$> sudo python3 -m http.server -b xxx.xxx.xxx.xxx 80[or 443]
Here, xxx.xxx.xxx.xxx represent the public IP, and the http.server
can be replaced with any web server such as Apache, Nginx or Podman container.
To avoid the influence from firewall, I disabled the firewalld.service
with:
$> sudo systemctl stop firewalld.service
Furthermore, before running the http server, I have confirmed that no other process listening on port 80 or 443 by:
$> netstat -lnt | grep 80[or 443]
$> # nothing returned
So, normally when some one access this server, for example using:
curl xxx.xxx.xxx.xxx
It should be responded with some content from the running server, e.g. the folders and files under the current dir.
But in my case, this command returns "404 page not found" on port 80 and "Client sent an HTTP request to an HTTPS server." on port 443 in plain text, respectively. This error only occurs on port 80 and 443 with public IP access, that means the following action works.
$> curl localhost
In fact, it doesn't matter whether there is a running http server. Seem like there is an invisible HTTP server and running with higher priority.
I tried a lot to handle this error and found that when the status of firewalld.service
changed, e.g stop/start/restart the firewalld.service
, there will be a short time (about 10 sec) to access the running server normally after the change.
All running services all listed as below:
liuchang@xenonpy ~ ❯❯❯ systemctl --type=service --state=running
UNIT LOAD ACTIVE SUB DESCRIPTION
accounts-daemon.service loaded active running Accounts Service
atd.service loaded active running Job spooling tools
auditd.service loaded active running Security Auditing Service
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service loaded active running NTP client/server
colord.service loaded active running Manage, Install and Generate Color Profiles
crond.service loaded active running Command Scheduler
cups.service loaded active running CUPS Scheduler
dbus.service loaded active running D-Bus System Message Bus
firewalld.service loaded active running firewalld - dynamic firewall daemon
gdm.service loaded active running GNOME Display Manager
gssproxy.service loaded active running GSSAPI Proxy Daemon
irqbalance.service loaded active running irqbalance daemon
k3s.service loaded active running Lightweight Kubernetes
ksmtuned.service loaded active running Kernel Samepage Merging (KSM) Tuning Daemon
libstoragemgmt.service loaded active running libstoragemgmt plug-in server daemon
mcelog.service loaded active running Machine Check Exception Logging Daemon
ModemManager.service loaded active running Modem Manager
NetworkManager.service loaded active running Network Manager
packagekit.service loaded active running PackageKit Daemon
polkit.service loaded active running Authorization Manager
rdma-ndd.service loaded active running RDMA Node Description Daemon
rhsmcertd.service loaded active running Enable periodic update of entitlement certificates.
rngd.service loaded active running Hardware RNG Entropy Gatherer Daemon
rpcbind.service loaded active running RPC Bind
rsyslog.service loaded active running System Logging Service
rtkit-daemon.service loaded active running RealtimeKit Scheduling Policy Service
smartd.service loaded active running Self Monitoring and Reporting Technology (SMART) Daemon
sshd.service loaded active running OpenSSH server daemon
sssd.service loaded active running System Security Services Daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-machined.service loaded active running Virtual Machine and Container Registration Service
systemd-udevd.service loaded active running udev Kernel Device Manager
tuned.service loaded active running Dynamic System Tuning Daemon
udisks2.service loaded active running Disk Manager
upower.service loaded active running Daemon for power management
user@1000.service loaded active running User Manager for UID 1000
user@42.service loaded active running User Manager for UID 42
wpa_supplicant.service loaded active running WPA supplicant
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
40 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
I have no idea about this and hope someone can help me. Thanks in advance!