Link to home
Start Free TrialLog in
Avatar of Jasmin shahrzad
Jasmin shahrzad

asked on

httpd problem

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?
Avatar of George Sas
George Sas
Flag of Denmark image

And what does your httpd log file say ?
You followed complete guide on setting up the httpd ? (including virtual hosts etc)
Avatar of Jasmin shahrzad
Jasmin shahrzad

ASKER

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
No matching DirectoryIndex (index.html)
Do you have an index.html page / file ?
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
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.
also don't use 10.10.1.10 localhost ... better use: 10.10.1.10 myhostname
(with myhostname being the right hostname).
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
ASKER CERTIFIED SOLUTION
Avatar of George Sas
George Sas
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it's failed already in step 2 .i  say http://ip  nothing appear
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
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.
" 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..
i setting ip as serverName in my httpd.conf and restart httpd error in httpd service is disappear now. but still no respond
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

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
sudo should not be needed ;-), just curl will do.

alsif you use curl from a different system?
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.
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

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
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.
sudo netstat -pluten | grep :80
tcp6       0      0 :::80                   :::*                    LISTEN      0          535603     23128/httpd
I'll ask another way.

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

Yes/No?
no .no container :-)
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

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.
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.
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
Everything seems correct.

Try this from your Windows machine...

ping 10.10.1.10

Open in new window

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
Okay, now post the output of...

curl -I -L 10.10.1.10

Open in new window


Similar to what noci requested.
This curl take timeout
curl (7) failed to connect to 10.10.1.10 port 80: timed out  from my windows cmd
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
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.