httpd problem

Jasmin shahrzad
Jasmin shahrzad used Ask the Experts™
on
i have a centos 7 and installing httpd on it.
i open firewall for port 80 and start httpd services. service is running ok.

in my etc/hosts ihave
127.0.0.1 localhost localhost.localdomain
..
..
10.10.1.10  localhost

in my httpd.conf  ihave
ServerName 10.10.1.10

browse 10.10.1.10 says :  Not possible to connect to website 10.10.0.10

what is wrong here?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
George SasIT Engineer

Commented:
And what does your httpd log file say ?
You followed complete guide on setting up the httpd ? (including virtual hosts etc)

Author

Commented:
i tail /var/log/httpd/errorlog:

[lbmethod_heartbeat:notice] [pid 15969] AH02282: No slotmem from mod_heartmonitor
[Wed Sep 04 12:51:32.058431 2019] [mpm_prefork:notice] [pid 15969] AH00163: Apache/2.4.6 (CentOS) configured -- resuming normal operations
[Wed Sep 04 12:51:32.058456 2019] [core:notice] [pid 15969] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Sep 04 12:52:44.690945 2019] [autoindex:error] [pid 15970] [client 127.0.0.1:40748] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
George SasIT Engineer

Commented:
No matching DirectoryIndex (index.html)
Do you have an index.html page / file ?
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
i used https://tecadmin.net/install-nagios-core-service-on-centos-rhel/
for setup nagios core.
i am not so familier with centos my /var/www/html is nothing file included what i have is a nagiosconf file in /etc/httpd/conf.d
George SasIT Engineer

Commented:
In order for the web server to "show" something you will need a valid index.htm or index.html file in the folder.
Just create a text file with some kind of content and rename it to index.html , then place it in the folder.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
also don't use 10.10.1.10 localhost ... better use: 10.10.1.10 myhostname
(with myhostname being the right hostname).

Author

Commented:
i just create a file
This is a test
and name it index.html in /var/www/html/
now error log is :
[Wed Sep 04 13:17:44.711804 2019] [autoindex:error] [pid 15970] [client 127.0.0.1:41016] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
IT Engineer
Commented:
Here is a small guide on how to set it up including permissions, virtual hosts etc.
https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-centos-7
Try to follow those steps and see if the problem persists.

Author

Commented:
it's failed already in step 2 .i  say http://ip  nothing appear

Author

Commented:
i think the problem is in my host httpd service says
 httpd[18228]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::221:f6ff...s message
George SasIT Engineer

Commented:
Yes, probably because you already configured some of the options and you did not follow the guide as from a "clean" install. Continue to the other steps and make sure configuration is accurate with what you are trying to achieve.
Looking at the error you get , this is a virtual host or permission issue.
George SasIT Engineer

Commented:
" httpd[18228]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::221:f6ff...s message " 
You never posted this error..

Author

Commented:
i setting ip as serverName in my httpd.conf and restart httpd error in httpd service is disappear now. but still no respond
nociSoftware Engineer
Distinguished Expert 2018

Commented:
did you also put 10.10.1.10 serverName  in the host file?
otherwise it will only listen on the 127.0.0.1 address (only accessible from the host itself...).

you can use curl to better see responses:

curl -v http://ip
curl -v http://serverName

Open in new window

Author

Commented:
yes i did
when i say http://ip  or http://nagios(my server name) return the test.html pages i mean

 sudo curl http://nagios
 this is a test page
nociSoftware Engineer
Distinguished Expert 2018

Commented:
sudo should not be needed ;-), just curl will do.

alsif you use curl from a different system?

Author

Commented:
no i did it step by step at step 4 says incloude:  IncludeOptional sites-enabled/*.conf at the end of httpd.conf file
then at the last step restart httpd then it's failed for that line.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
First things first.

1) Mention if you're running your Apache server native to the machine hardware or inside some VM or container.

2) Mention if you're running your browser on the same physical machine/VM/container or some other machine/VM/container.

3) Provide output of netstat, as in...

# netstat -pluten | grep :80
tcp6       0      0 :::80                   :::*                    LISTEN      0          120296645  166130/apache2

Open in new window

Author

Commented:
yes it's ok whiteout sudo but not from other server. it's timeout for port 80.
but nmap ip says : 22 and 80/tcp open http

Author

Commented:
netstat -pluten | grep :80
(No info could be read for "-p": geteuid()=9002 but you should be root.)
tcp6       0      0 :::80                   :::*                    LISTEN      0          535603     -

it's not incloud linux container or somthing like that it's vmware and centos on it.

Author

Commented:
sudo netstat -pluten | grep :80
tcp6       0      0 :::80                   :::*                    LISTEN      0          535603     23128/httpd
David FavorFractional CTO
Distinguished Expert 2018

Commented:
I'll ask another way.

State if your Apache instance + browser running inside the exact runtime environment - machine/VM/container.

Yes/No?

Author

Commented:
no .no container :-)
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Okay.

Now provide output of...

# Inside your container where Apache is running.
ifconfig | grep inet | grep -v inet6

# On machine where browser is running.
ifconfig | grep inet | grep -v inet6
route -n

Open in new window

Author

Commented:
i try firefox on server and try to run nagios on it .
httpd  error_log say:
 AH01276: Cannot serve directory /usr/local/nagios/share/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

and from browser say: Forbidden

You don't have permission to access /nagios/ on this server.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
This question started about accessing Apache from your browser.

Let's stick with getting your browser to connect with Apache for this question.

Open another question for Nagios problems, as the problem mentioned above can only be debugged once you have a browser connection to Apache.

Author

Commented:
ifconfig | grep inet | grep -v inet6  
inet 10.10.1.10 netmask 255.255.255.0. broadcast 10.10.1.255
inet 127.0.0.1 netmask 255.0.0.0

and broswer is running in 10.10.5.20 (windows)

and rout n:
destination        gateway                Genmask    Flags Metric Ref    Use Iface
0.0.0. 0                10.10.1.10              0.0.0.0         UG    0      0        0 eth0
10.10.1.10               0.0.0.0         255.255.255.0   U     100    0        0 eth0
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Everything seems correct.

Try this from your Windows machine...

ping 10.10.1.10

Open in new window

Author

Commented:
Pinging 10.10.1.10 with 32 bytes of data:
Reply from 10.10.1.10: bytes=32 time=4ms TTL=64
Reply from 10.10.1.10: bytes=32 time=6ms TTL=64
Reply from 10.10.1.10: bytes=32 time=4ms TTL=64
Reply from 10.10.1.10: bytes=32 time=4ms TTL=64
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Okay, now post the output of...

curl -I -L 10.10.1.10

Open in new window


Similar to what noci requested.

Author

Commented:
This curl take timeout
curl (7) failed to connect to 10.10.1.10 port 80: timed out  from my windows cmd

Author

Commented:
i have 10.10.5.x (20)in my windows and i want to connect to 10.10.1.10 isn't it a subnet problem? because i running firefox from centos and i connet directly to httpd and nagios. but not from my local
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Since ping works + curl fails, my guess is maybe a firewall problem.

Disable firewalls everywhere, then retest. Once port 80 is working, then enable each firewall + retest, to find the problem firewall.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial