0

I just setup a new amazon ec2 instance and installed apache and setup the configs and everything but when i visit the url there is nothing....do i have the proper ports open and asscociated to apache...here is my ports..am i missing anything

 sudo netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      1260/mysqld         
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1116/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1290/sendmail: acce 
tcp        0      0 10.244.133.179:34223        207.171.163.206:80          TIME_WAIT   -                   
tcp        0    208 10.244.133.179:22           24.172.85.150:3797          ESTABLISHED 1432/sshd: ec2-user 
tcp        0      0 :::80                       :::*                        LISTEN      1324/httpd          
tcp        0      0 :::22                       :::*                        LISTEN      1116/sshd           
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1001/dhclient       
udp        0      0 10.244.133.179:123          0.0.0.0:*                               1136/ntpd           
udp        0      0 127.0.0.1:123               0.0.0.0:*                               1136/ntpd           
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               1136/ntpd           
udp        0      0 fe80::1031:3dff:fe0:123     :::*                                    1136/ntpd           
udp        0      0 ::1:123                     :::*                                    1136/ntpd           
udp        0      0 :::123                      :::*                                    1136/ntpd

also running

sudo lsof -i -n -P 
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dhclient 1001     root    5u  IPv4   1942      0t0  UDP *:68 
sshd     1116     root    3u  IPv4   2412      0t0  TCP *:22 (LISTEN)
sshd     1116     root    4u  IPv6   2414      0t0  TCP *:22 (LISTEN)
ntpd     1136      ntp   16u  IPv4   2497      0t0  UDP *:123 
ntpd     1136      ntp   17u  IPv6   2498      0t0  UDP *:123 
ntpd     1136      ntp   18u  IPv4   2500      0t0  UDP 127.0.0.1:123 
ntpd     1136      ntp   19u  IPv4   2501      0t0  UDP 10.244.133.179:123 
ntpd     1136      ntp   20u  IPv6   2502      0t0  UDP [::1]:123 
ntpd     1136      ntp   21u  IPv6   2503      0t0  UDP [fe80::1031:3dff:fe00:8249]:123 
mysqld   1260    mysql   10u  IPv4   2644      0t0  TCP *:3306 (LISTEN)
sendmail 1290     root    4u  IPv4   2701      0t0  TCP 127.0.0.1:25 (LISTEN)
httpd    1324     root    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1403   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1404   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1405   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1406   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1407   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1408   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1409   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
httpd    1410   apache    4u  IPv6   2745      0t0  TCP *:80 (LISTEN)
sshd     1432     root    3r  IPv4   3313      0t0  TCP 10.244.133.179:22->24.172.85.150:3797 (ESTABLISHED)
sshd     1434 ec2-user    3u  IPv4   3313      0t0  TCP 10.244.133.179:22->24.172.85.150:3797 (ESTABLISHED)

3 Answers 3

1

There are two points:

  1. It is not clear which process is listening the port 80. You have to use sudo before netstat command to be able to see the process name. See the first line after netstat command in your output.
  2. The empty page may not be related to the port number. You need to look at your server logs access and error logs /var/log/apache2/access.log and /var/log/apache2/error.log.
2
  • updated my question with sudo but there is nothing in the logs at all Jan 18, 2012 at 16:12
  • seems to be listening to port 80 but i am getting nothing in the browser Jan 18, 2012 at 16:15
1

In your lsof listing, I don't see any httpd process listening on the IPv4 protocol. All processes seem to be bound to IPv6 only.

I'd expect to see lines similar to these in :

tcp        0      0  0.0.0.0:80              0.0.0.0:*               LISTEN      4012/httpd
tcp6       0      0  :::80                   :::*                    LISTEN      4012/httpd

While lsof should show something like:

apache2    4012           www-data    7u  IPv4   12080      0t0  TCP *:80 (LISTEN)
apache2    4012           www-data    8u  IPv6   12081      0t0  TCP *:80 (LISTEN)

What are your Listen and NameVirtualHost directives set to?

5
  • where do i see that Jan 18, 2012 at 16:42
  • what file do i look in httpd.conf? Jan 18, 2012 at 16:43
  • just grep -R Listen /etc/httpd and grep -R NameVirtual /etc/httpd, assuming /etc/httpd is where httpd.conf is.
    – Tim
    Jan 18, 2012 at 16:49
  • ok Listen is Listen 80 and NameVirtual is commented out # # Use name-based virtual hosting. # #NameVirtualHost *:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # Jan 18, 2012 at 16:52
  • Can you post the output of apache2ctl -S? Jan 18, 2012 at 21:11
0

Your httpd is running here. You can make sure it by telneting to the port 80 and 443. if you are on linux machine try to execute "telnet 80" then it should show as follows.

Connected to localhost. Escape character is '^]'.

which mean your httpd is listing on port 80. To troubleshoot check the access and error logs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .