5
3
I'm setting up a VirtualBox with CentOS so I can test out all my code, etc. on a Linux box instead of the Windows I use for development.
I just got the SSH working (I SSH to localhost:2222 and it port forwards it to the virtualbox port 22).
I'm trying to do the same thing with Apache, to get a web server up and running.
I've portforwarded port 8888 on localhost to port 80 in my CentOS Virtualbox, but I can't seem to access anything with localhost:8888 in my browser?
Apache is also definitely running:
ps -e | grep httpd 2108 ? 00:00:00 httpd 2110 ? 00:00:00 httpd 2111 ? 00:00:00 httpd 2112 ? 00:00:00 httpd 2113 ? 00:00:00 httpd 2114 ? 00:00:00 httpd 2115 ? 00:00:00 httpd 2116 ? 00:00:00 httpd 2117 ? 00:00:00 httpd
Iptables:
[root@CentOS /]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Fri Jan 27 18:26:36 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [32:2278]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Fri Jan 27 18:26:36 2012
Nmap output:
[root@CentOS conf]# nmap localhost Starting Nmap 5.21 ( http://nmap.org ) at 2012-01-28 00:58 WST Nmap scan report for localhost (127.0.0.1) Host is up (0.0000090s latency). Hostname localhost resolves to 3 IPs. Only scanned 127.0.0.1 Not shown: 993 closed ports PORT STATE SERVICE 22/tcp open ssh 23/tcp open telnet 25/tcp open smtp 80/tcp open http 111/tcp open rpcbind 443/tcp open https 631/tcp open ipp
Stopped iptables, and posted the file in the OP – user1045696 – 2012-01-27T15:13:14.300
1Firewall rules look good. Can you connect to port 80 on your VM from your VM? Telnet is good for testing this. telnet [vm ip] 80 and telnet 127.0.0.1 80 . Try them both. If it only connects to 127.0.0.1 then apache is only binding to the loopback interface (lo) – chuck – 2012-01-27T17:15:25.807
What do you have for "Listen" lines in your httpd.conf file? Are you doing anything with Virtual Hosts that would try and bind to a certain IP address? – chuck – 2012-01-27T18:07:10.647
Neither 127.0.0.1 or [vm ip] works for telneting to port 80. It gets to connecting to [ip], and then says connection closed by foreign host. For the listen lines, it says
listen 80
– user1045696 – 2012-01-28T02:17:32.270I screwed up. I should have told you to run netstat -tlpn That will give you a list of all listening TCP ports on your machine and what program is doing the listening. – chuck – 2012-01-29T13:54:30.193