# apache problem

**URL:** <https://community.unix.com/t/apache-problem/217990>\
**Category:** Debian\
**Created:** [October 25, 2008, 10:46pm UTC](https://community.unix.com/t/apache-problem/217990 "2008-10-25T22:46:54Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [October 25, 2008, 10:46pm UTC](https://community.unix.com/t/apache-problem/217990/1 "2008-10-25T22:46:54Z")

</div>

hi all,  
I can't get my index.html to display on the web browser. Please point it out the reason.

this is what i had done so far:

1. I have registered a dns name pointing to my public ip (it is done automatic)
2. my server name is set same as the dns name
3. I have configured httpd.conf like this  
ServerName [http://xsoldier2006.dnsdojo.org](http://xsoldier2006.dnsdojo.org) // my dns name  
DocumentRoot "/var/www/html" // i place my index.html in /var/www/html  
DirectoryIndex index.html index.html.var  
HostnameLookups off
4. I have my index.html in the /var/www/html folder

what else should i do? did i miss a step? why it is not on the browser? thanks

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [October 25, 2008, 11:43pm UTC](https://community.unix.com/t/apache-problem/217990/2 "2008-10-25T23:43:49Z")

</div>

> [@k2k](#):
>
> hi all,  
> I can't get my index.html to display on the web browser. Please point it out the reason.

What operating system? What does your apache error log say?

> [@](#):
>
> this is what i had done so far:
> 
> 1. I have registered a dns name pointing to my public ip (it is done automatic)
> 2. my server name is set same as the dns name
> 3. I have configured httpd.conf like this  
> ServerName [http://xsoldier2006.dnsdojo.org](http://xsoldier2006.dnsdojo.org) // my dns name  
> DocumentRoot "/var/www/html" // i place my index.html in /var/www/html  
> DirectoryIndex index.html index.html.var  
> HostnameLookups off

The ServerName option does not take 'http://'. Just the hostname of the machine. Generally output from

```plaintext
/bin/hostname

```

Make sure your /etc/hosts file matches what you put here.

> [@](#):
>
> 1. I have my index.html in the /var/www/html folder
> 
> what else should i do? did i miss a step? why it is not on the browser? thanks

Also, does your ISP block port 80? You can check at [Open Port Check Tool](http://canyouseeme.org) .

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [October 26, 2008, 11:22am UTC](https://community.unix.com/t/apache-problem/217990/3 "2008-10-26T11:22:43Z")

</div>

hi, glen.barber . I am using fedora9. and error\_log has this:  
"error\_log" 7L, 745C  
[Fri Oct 24 13:24:51 2008] [notice] SELinux policy enabled; httpd running as context unconfined\_u:system\_r:httpd\_t:s0  
[Fri Oct 24 13:24:51 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)  
[Fri Oct 24 13:24:51 2008] [notice] Digest: generating secret for digest authentication ...  
[Fri Oct 24 13:24:51 2008] [notice] Digest: done  
[Fri Oct 24 13:24:51 2008] [notice] mod\_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.  
[Fri Oct 24 13:24:51 2008] [notice] mod\_python: using mutex\_directory /tmp  
[Fri Oct 24 13:24:51 2008] [notice] Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6 mod\_python/3.3.1 Python/2.5.1 mod\_ssl/2.2.9 OpenSSL/0.9.8g mod\_perl/2.0.3 Perl/v5.10.0 configured -- resuming normal operations

should i disable seLinux??

this is the message generated from [Open Port Check Tool](http://www.canyouseeme.org)  
Error: I could not see your service on port (80)  
Reason: Connection timed out

so that means port 80 is blocked by my ISP? ..... i'll look into [noip.com](http://noip.com)

Any more suggestion? thanks a lot for the input.

---

<div class="post-metadata">

**Author:** ![jacco](https://community.unix.com/letter_avatar/jacco/32/5_5575768a8748004e209b776fc1b2916d.png) [@jacco](https://community.unix.com/u/jacco)\
**Post date:** [October 27, 2008, 5:02am UTC](https://community.unix.com/t/apache-problem/217990/4 "2008-10-27T05:02:49Z")

</div>

First look if your server is listening to port 80

> [@](#):
>
> # netstat -an | grep ':80' | grep 'LISTEN'

If your server is placed behind a router/firewall: is port 80 forwarded (destination-NAT) to port 80 on your server?

Run tcpdump on your server to see if any connection is made

> [@](#):
>
> # tcpdump port 80

While running tcpdump try to make a connection from the internet to your webserver. If there is no output, the webserver is not reachable from the internet caused by portblocking, port-80 not being forwarded or something like that.

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [October 27, 2008, 11:09am UTC](https://community.unix.com/t/apache-problem/217990/5 "2008-10-27T11:09:17Z")

</div>

> [@k2k](#):
>
> hi, glen.barber . I am using fedora9. and error\_log has this:  
> "error\_log" 7L, 745C  
> [Fri Oct 24 13:24:51 2008] [notice] SELinux policy enabled; httpd running as context unconfined\_u:system\_r:httpd\_t:s0  
> [Fri Oct 24 13:24:51 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)  
> [Fri Oct 24 13:24:51 2008] [notice] Digest: generating secret for digest authentication ...  
> [Fri Oct 24 13:24:51 2008] [notice] Digest: done  
> [Fri Oct 24 13:24:51 2008] [notice] mod\_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.  
> [Fri Oct 24 13:24:51 2008] [notice] mod\_python: using mutex\_directory /tmp  
> [Fri Oct 24 13:24:51 2008] [notice] Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6 mod\_python/3.3.1 Python/2.5.1 mod\_ssl/2.2.9 OpenSSL/0.9.8g mod\_perl/2.0.3 Perl/v5.10.0 configured -- resuming normal operations

If you're in front of the machine, open 127.0.0.1 in your browser. If apache is not running, you will get an error. If you're on the same LAN, open the host's IP in a local client's browser.

> [@](#):
>
> should i disable seLinux??

This should not be necessary.

> [@](#):
>
> this is the message generated from [Open Port Check Tool](http://www.canyouseeme.org)  
> Error: I could not see your service on port (80)  
> Reason: Connection timed out
> 
> so that means port 80 is blocked by my ISP? ..... i'll look into [noip.com](http://noip.com)

No-ip won't help you with port 80 being blocked. At best, you can have apache listen on an alternate port.

Regards.

---

<div class="post-metadata">

**Author:** ![csorhand](https://community.unix.com/letter_avatar/csorhand/32/5_5575768a8748004e209b776fc1b2916d.png) [@csorhand](https://community.unix.com/u/csorhand)\
**Post date:** [October 27, 2008, 10:53pm UTC](https://community.unix.com/t/apache-problem/217990/6 "2008-10-27T22:53:44Z")

</div>

K2k,

Just to isolate the issue please disable the selinux for the meantime.  
If your httpd is running the port 80 is open or any port you configure at your web server.

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [October 28, 2008, 4:41pm UTC](https://community.unix.com/t/apache-problem/217990/7 "2008-10-28T16:41:03Z")

</div>

I don't believe SeLinux to be the problem here. I think he's trying to access his site using his registered domain name, and because port 80 is blocked by his ISP, it is not connecting.

This is why I want him to try to access the page from inside his LAN if possible.

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [October 28, 2008, 8:51pm UTC](https://community.unix.com/t/apache-problem/217990/8 "2008-10-28T20:51:20Z")

</div>

thx for everyone trying to help. okay, this is what i tried out. Instead of working on my linux box (192.xxx.1.5), gateway is 192.xxx.1.1, I tried to host my page with the my laptop(windows xp) 192.xxx.1.10 with wampserver setup. everything worked out. (of course I had to forward port http port 80 with my router for 192.xxx.1.10)

well, if I can host with my xp box with port 80 forwarded, that i should be able to host with my linux box (192.xxx.1.5)with the same port (http)forwarded right? that means 80 is actually not blocked by my ISP right?

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [October 28, 2008, 9:17pm UTC](https://community.unix.com/t/apache-problem/217990/9 "2008-10-28T21:17:29Z")

</div>

another concern, i have been using secure shell to login to my server to do everything i have done. it shouldn't be a problem right? I don't have to configure my httpd and things with my actualy server box right? i ask this is because when i do "lynx 127.0.0.1" it says it cannot connect to the remote host. i mean if i "lynx 127.0.0.1" ,, should it connect the local host instead???"

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [October 29, 2008, 4:02pm UTC](https://community.unix.com/t/apache-problem/217990/10 "2008-10-29T16:02:11Z")

</div>

I am beginning to think this is less of an apache problem, but a sysadmin problem.

You still have not shown us output from your error log for apache after I told you to fix your ServerName directive, nor output from netstat showing that apache is in fact running.

You should also know, regardless of OS but from a networking standpoint, that localhost and 127.0.0.1 are 90% of the time the same thing.

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [November 5, 2008, 5:08pm UTC](https://community.unix.com/t/apache-problem/217990/11 "2008-11-05T17:08:20Z")

</div>

okay, now i think my apache is actually running. but it come to an permission problem. when i tried to access the page on the browser, i get:

Forbidden

You don't have permission to access / on this server.  
Apache/2.2.9 (Fedora) Server at [xsoldier2006.dnsdojo.org](http://xsoldier2006.dnsdojo.org) Port 80

any suggestion to help me make through it? thanks

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [November 5, 2008, 5:14pm UTC](https://community.unix.com/t/apache-problem/217990/12 "2008-11-05T17:14:27Z")

</div>

opps, never mine. I got it! thanks everyone tried to help.

solution: chmod 755 /var // if anyone is curious

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [November 5, 2008, 5:14pm UTC](https://community.unix.com/t/apache-problem/217990/13 "2008-11-05T17:14:59Z")

</div>

```nohighlight
<html>
<head>
<title>hi</title>
</head>
<body>
<p>this is my first page in Linux</p>
</body>
</html>

```

Seems to work from my end.  
\*Note: I intentionally included the source from the page -- I didn't screw up the formatting.

---

<div class="post-metadata">

**Author:** ![glen.barber](https://community.unix.com/letter_avatar/glen.barber/32/5_5575768a8748004e209b776fc1b2916d.png) [@glen.barber](https://community.unix.com/u/glen.barber)\
**Post date:** [November 5, 2008, 5:17pm UTC](https://community.unix.com/t/apache-problem/217990/14 "2008-11-05T17:17:07Z")

</div>

> [@k2k](#):
>
> opps, never mine. I got it! thanks everyone tried to help.
> 
> solution: chmod 755 /var // if anyone is curious

You should only `chmod' the directory Apache is using. Depending on your distribution, it could be '/var/www' or the like. (I assume you're using some Debian variant.)

You also shouldn't need to `chmod' /var/www anyway... It should 'just work' as is. I assume you changed permissions to not need to edit as root.

---

<div class="post-metadata">

**Author:** ![k2k](https://community.unix.com/letter_avatar/k2k/32/5_5575768a8748004e209b776fc1b2916d.png) [@k2k](https://community.unix.com/u/k2k)\
**Post date:** [November 6, 2008, 10:12pm UTC](https://community.unix.com/t/apache-problem/217990/15 "2008-11-06T22:12:08Z")

</div>

glen,  
hey i really appreciate you keep on helping all the way, thanks. yes I chmod for many directories because I felt (still feeling) so unsecured after checking my secure log. Many people trying to hack in and some actually did hack in. I have my firewall running, installed fail2ban, i really didn't know what else to do besides chmod 700 to files ... (definitely not a right way to do)... so yeah,, i changed my /var chmod 755 and apache works. thanks again for all the posts
