-2

I have some problems with httpd and can't configure it(can't open in browser). I have done it a lot of times, but now I missing something.

I have installed CentOS 6.5 on virtualbox with ubuntu 14. Use bridge connection with local ip addr.

In httpd.conf change this line,

#Listen 192.168.1.144:80

but without "#" won't start httpd service. With 127.0.0.1 or 0.0.0.0 also have the same problem.

In iptables

    :INPUT ACCEPT [0:0]
    :`FORWARD ACCEPT [0:0]`
    :OUTPUT ACCEPT [0:0]
    -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
    -A INPUT -j REJECT --reject-with icmp-host-prohibited
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A FORWARD -j REJECT --reject-with icmp-host-prohibited
  COMMIT

port 80 is open. In my router is also open.

I try and with nginx, but I have the same problem. I start to thing the problem is virtualbox or ubuntu.

EDIT 1: This is from error_log:

[Mon Jul 14 17:11:02 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jul 14 17:11:02 2014] [notice] Digest: generating secret for digest authentication ...
[Mon Jul 14 17:11:02 2014] [notice] Digest: done
[Mon Jul 14 17:11:02 2014] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Mon Jul 14 18:18:53 2014] [notice] caught SIGTERM, shutting down
[Mon Jul 14 18:18:54 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon Jul 14 18:18:54 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jul 14 18:18:54 2014] [notice] Digest: generating secret for digest authentication ...
[Mon Jul 14 18:18:54 2014] [notice] Digest: done
[Mon Jul 14 18:18:54 2014] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations

Maybe the problem is in the VirtualBox, because on my Ubuntu(the main OS) apache is running very well.

EDIT 2

PROBLEM SOLVED!

I change VirtualBox with VMware and now I don't have problems.. :)

ValeriRangelov
  • 119
  • 2
  • 10
  • 1
    can you make it more clear,what you trying to achieve and where are checking and what are logs in error.log of apache? – TBI Infotech Jul 14 '14 at 13:15

2 Answers2

0

I would suggest splitting your problems:

  1. Firewall: Try running ncat tcp server on port 80 and try to access from behind firewalls
  2. httpd: Run http locally and ncat/telnet to it locally to make sure it is working

Also check httpd error logs for any issues.

0

It seems like you may have multiple problems going on here, so firstly we'll start at the beginning ensuring you have set up network access correctly in VirtualBox and Centos. All I have written here is a guide to identify where the issue is, not really any information on how to resolve the problem, as you will need to provide more information for a solution to be advised.

Problem 1: Internet Access Firstly, in VirtualBox make sure you have the Network Adapter set as 'Attached to Bridged Adapter' and then select the source of your actual machine's internet connection, i.e. en0: Wi-Fi.

Secondly, start your virtual machine, log in as root and type in ifconfig. You should see something like this and take note of the inet addr:

eth0      Link encap:Ethernet  HWaddr 08:00:27:4D:22:B1  
          inet addr:192.168.3.105  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe4d:22b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:632 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:63848 (62.3 KiB)  TX bytes:8159 (7.9 KiB)

Then you will want to check you can ping google.com. If this is successful, you should see lines like this appear. Press CTRL + C to cancel:

64 bytes from blablabla.bla.com (*.*.*.*): icmp_seq=1 ttl=60 time=1.61 ms

If you get this far, you have internet access from your virtual machine. The next step is to test whether other machines can access your virtual machine.

Now you need to check other network machines on your network can see your virtual machine. Using a console on an actual machine ping the inet addr from the response to the ifconfig command you ran earlier.

Then use Nmap to check the open ports on the virtual machine by using the console on the actual machine again,. See http://nmap.org/book/install.html for useful information about Nmap. You should see a response containing a line similar to this:

80/tcp   open     http        Apache httpd 2.2.14 ((Centos))

If you get to this point and all is good then it is time to tackle the issues you definitely have in your httpd.conf file. If you get a different response to any of these stages, then your problems are bigger than your httpd.conf setup.

Edit 1:

Right, so, everything to this point is fine. You have port 80 open and you have network access, so the next job is to identify what is needed in your httpd.conf file.

You will certainly want to start with Listening to any incoming traffic on port 80 by changing that line to

Listen 80

Next you will also want to give us anything interesting that happens when you restart httpd:

service httpd restart

in your log file found at /var/log/httpd/error_log. You can watch this log grow while you do things like restart httpd in another console window by using tail e.g.:

tail /var/log/httpd/error_log

If you post anything relevant from your log as an edit in your question above, that will help us to diagnose the problem.

alpinehc
  • 16
  • 2