Connection to Port 80 refused

Issues related to applications and software problems and general support
Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Connection to Port 80 refused

Post by Nigmur » 2020/10/06 11:13:01

Goodday everyone, i am new in Linux and especially in Centos. I installed it on a Virtual box to utilize a server programm. Thing is i can't install anything or updates anything because everytime i have an error with port 80 : connection refused.

I searched A LOT on the internet but i can't find a solution. I don't have apache installed because i can't install it with the yum command and i did not find any guide to install it manually.

Here you can see that i have http and https (also ssh) added to the firewall, my iptables and the error with curl.

[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client http https ssh
ports:
protocols:
masquerade: yes
forward-ports:
source-ports:
icmp-blocks:
rich rules:

[root@localhost ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
3 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:67
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:67

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 192.168.122.0/24 ctstate RELATED,ESTABLISHED
2 ACCEPT all -- 192.168.122.0/24 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:68
[root@localhost ~]# firewall-cmd --add-port=80/tcp --permanent
success
[root@localhost ~]# curl -a 192.168.77.50
curl: (7) Failed to connect to 192.168.77.50 port 80: Connection refused
[root@localhost ~]#


if any of you now anything it will be of great help. I am running Centos 8 on VMware in a Windows 10 if this may help.

User avatar
TrevorH
Forum Moderator
Posts: 29903
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Connection to Port 80 refused

Post by TrevorH » 2020/10/06 12:26:13

Being unable to connect when you don't have anything running and listening on that port is expected behaviour. You would need to install a web server package like httpd or nginx and then configure them and run them to be able to connect.

It would be more profitable for you to post the output of your attempt to yum install httpd
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Re: Connection to Port 80 refused

Post by Nigmur » 2020/10/06 14:00:24

CentOS-8 - AppStream 0.0 B/s | 0 B 04:53
Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8 ... nfra=stock [Could not resolve host: mirrorlist.centos.org]
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8 ... nfra=stock [Could not resolve host: mirrorlist.centos.org]


This is the result of yum instal httpd. In the meanwhile i tried changing from dhcp to a static ip and i changed the interface from "ens33" to "eth0". The error now is no more "curl(7) port 80: connection refused" but this new one.

I tried changing to a static ip because a guy in my office advise me to do so but no problem was solved

User avatar
TrevorH
Forum Moderator
Posts: 29903
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Connection to Port 80 refused

Post by TrevorH » 2020/10/06 14:33:54

The error you quoted there means your DNS resolution is broken. Do you have 'nameserver' lines in /etc/resolv.conf pointing to valid, working DNS servers? Is the connection up? Is the routing correct?
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Re: Connection to Port 80 refused

Post by Nigmur » 2020/10/06 15:52:40

in /etc/resolv.conf i have this

# Generated by NetworkManager
nameserver 10.6.1.10
nameserver 8.8.8.8

The connection is up i think since i can go to internet and search and open pages without problems except that it doesn't open httpd pages. Working DNS server and routing correct i don't really know...How can i check this?

I mean Centos is on a virtual machine on a Windows pc . The connection on the real pc is fine without problems. This is what i have with "vi /etc/sysconfig/network-scripts/ifcfg-eth0" if it can be of help. The ip address is the ip address of the real connection on my pc (is it wrong?) .



TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="10.6.70.186"
PREFIX="24"
GATEWAY="10.6.70.1"
DNS1="10.6.1.10"
DNS2="8.8.8.8"
IPV6_PRIVACY="no"
~

Really sorry for this and really thanks for helping me. I am really new here and i am trying to understand stuff. Thanks again

User avatar
TrevorH
Forum Moderator
Posts: 29903
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Connection to Port 80 refused

Post by TrevorH » 2020/10/06 16:35:39

So you've set a static ip address and on some virtualisation solutions, that means you have to pick the right network mode for the VM in its settings (e.g. vmware settings). If you set it up as a NAT connection then it may forbid connections from ip addresses assigned in that VM that are not in its DHCP pool range. Does it work if you choose DHCP as a connection method?
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Re: Connection to Port 80 refused

Post by Nigmur » 2020/10/07 07:42:51

No, before it was dhcp but it gave me the error "curl(7) port 80: connection refused"

Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Re: Connection to Port 80 refused

Post by Nigmur » 2020/10/07 08:39:35

Or wait you mean to impose on VMware to put DHCP as a connection metod? Because i don't have anything like that on setting. I can use only NAT , Physical bridge and a custom one. Now i putted again DHCP as a connection method in Centos but it gave me the Curl(7) port 80 connection refused error. I tried to disable the firewall on Windows but still no success. Some guy in the offices said that i should change the repo of yum. But the problem is that AppStream never works.

Nigmur
Posts: 8
Joined: 2020/10/06 11:06:50

Re: Connection to Port 80 refused

Post by Nigmur » 2020/10/08 08:24:38

Someone please?

bspeedtriple
Posts: 2
Joined: 2020/03/11 10:41:58

Re: Connection to Port 80 refused

Post by bspeedtriple » 2020/10/08 10:26:49

When using a fixed ip address that is on the same subnet as your local windows pc you should set the connection type to bridge in Virtual box as far as I know.

I am not sure what you mean with : "The ip address is the ip address of the real connection on my pc" if you mean your Centos guest VM is having the same IP address as you windows host machine then this will not work. Give your CentOS vm for example ip address 10.6.70.187 make sure this address is not in the dhcp servers range and it is not in use by another computer on your network.

So virtual box network in bridge mode
your CentOS VM an IP address that is not in use by any other computer and on the same subnet as your windows computer should get you up and running.


Nigmur wrote:
2020/10/07 08:39:35
Or wait you mean to impose on VMware to put DHCP as a connection metod? Because i don't have anything like that on setting. I can use only NAT , Physical bridge and a custom one. Now i putted again DHCP as a connection method in Centos but it gave me the Curl(7) port 80 connection refused error. I tried to disable the firewall on Windows but still no success. Some guy in the offices said that i should change the repo of yum. But the problem is that AppStream never works.

Post Reply

Return to “CentOS 8 - General Support”