LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   can't access Centos 7 apache server default page (Server not found) (https://www.linuxquestions.org/questions/linux-server-73/cant-access-centos-7-apache-server-default-page-server-not-found-4175591229/)

Fardad74 10-11-2016 09:08 PM

can't access Centos 7 apache server default page (Server not found)
 
Hello friends.
I installed httpd server package in my centos7 on vmware and i wanted test it to see apache default page from windows using browser
(e.g: http://192.168.1.128). I configed both vm and windows vmnet8 to get an automatic dhcp ip addresses. now my centos have 192.168.1.128 and windows vmnet8 have 192.168.1.1.
My httpd service is running and The netstat -ntpl | grep -i httpd output says that httpd listening on port *:80. I have ping of my centos from windows cmd but i can't ping windows from centos.
when i typing http://192.168.1.128 in firefox in windows to see apache default page it says server not found! also my centos hadn't any iptables installed and i used dhclient -r command to realease ip address.

Can anyone help me? :newbie:

c0wb0y 10-12-2016 01:00 AM

I know that real estate agents like to say 'Location, location, location!' when selling properties. But I would tell you this: 'Logs, logs, logs' check your logs.

Jjanel 10-12-2016 02:01 AM

Check/post, from both, netstat -rn (yes, win 'run cmd' should be able to do this)
What exact win IPaddress# doesn't respond from centos?
Maybe look into `tcpdump` to make sure that win is *really* pinging centos
To me, it seems strange=bad that ping pkts [two-way: both paths *must* route ok!]
only work from win but not your centos: this may be the clue to what's wrong.
(on your centos, I assume: `telnet localhost 80` GET / works ok)

More: I don't know vmware, so I don't know how to configure; a web-search of:
vmware guest can't ping host but host can ping guest
returned lots, but wasn't precise enough, sorry.
Here's one, of just two matches!, from quoting search: (but it has tons of vmware details)
vmware "guest can't ping host" but "host can ping guest"

Again, I'm not even sure I'm 'on the right track'. Other LQ'ers advice welcome here.

Fardad74 10-12-2016 02:32 AM

Quote:

Originally Posted by Jjanel (Post 5616862)
Check/post, from both, netstat -rn (yes, win 'run cmd' should be able to do this)
What exact win IPaddress# doesn't respond from centos?
Maybe look into `tcpdump` to make sure that win is *really* pinging centos
To me, it seems strange=bad that ping pkts [two-way: both paths *must* route ok!]
only work from win but not your centos: this may be the clue to what's wrong.

[root@localhost etc]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.2.2 0.0.0.0 UG 0 0 0 eno16777736
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eno16777736
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0


The ip address of windows vmnet8 interface is 192.168.2.1 , i saw it in its status --> details .and when i ping this ip from centos it doesn't response , just thinking , anything will not appear and then i press ctrl+c to stop it. one of my friends told me do these step by step but didn't worked :

#ifconfig
#dhclient -r
#dhclient eno16777736
#ifconfig ------> vmnet8

Windows: Enable VMNET8 on Windows

Windows: ping <Linux_ip>


#service iptables stop ----> Disable Firewall(iptable)
#setenforce 0 (Disable SELinux)


#service httpd status
#service httpd start
#netstat -ntlp | grep -i httpd


#rm -rf /var/www/html/index.html

Windows: http://<LINUX_IP>


my current ifconfig status:

[root@localhost etc]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.128 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::20c:29ff:fe89:c9ea prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:89:c9:ea txqueuelen 1000 (Ethernet)
RX packets 22012 bytes 26637825 (25.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11992 bytes 2148787 (2.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


I just want see and test that Apache default page first in my life, i really want learn web servering :Pengy:

Jjanel 10-12-2016 02:46 AM

Oooops, I added this (which will let you 'semi-see' your webserver!) while you were replying!
On your centos: (hopefully it has telnet installed)

telnet localhost 80
GET /

(there's no prompt!, where you type the GET / Don't let that confuse...)

I don't know/understand vmware "virbr0"; maybe posting about your vmware guest net config might enable *other* LQ'ers to advise...

I don't understand why you `rm -rf /var/www/html/index.html` (sounds [to me] like killing the homepage! But again, I don't know. *I'm learning too!*)

Awaiting your response about the above telnet localhost 80
p.s. try tcpdump

Fardad74 10-12-2016 02:58 AM

Quote:

Originally Posted by Jjanel (Post 5616867)
Oooops, I added this (which will let you 'semi-see' your webserver!) while you were replying!
On your centos: (hopefully it has telnet installed)

telnet localhost 80
GET /

(there's no prompt!, where you type the GET / Don't let that confuse...)

I don't know/understand vmware "virbr0"; maybe posting about your vmware guest net config might enable *other* LQ'ers to advise...


that rm -rf command was for my friends system to delete previous alterations , let's skip that i didn't run it

that rm -rf was because some other alterations on his system was made and he not told me run that command on mine! so let's skip that , i didn't run itit's
I don't understand why you `rm -rf /var/www/html/index.html` (sounds [to me] like killing the homepage! But again, I don't know. *I'm learning too!*)

Awaiting your response about the above telnet localhost 80
p.s. try tcpdump

[root@localhost etc]# tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on virbr0, link-type EN10MB (Ethernet), capture size 65535 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

telnet output is this with no other output :
[root@localhost etc]# telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>501 Not Implemented</title>
</head><body>
<h1>Not Implemented</h1>
<p>GET/ to / not supported.<br />
</p>
</body></html>
Connection closed by foreign host.

Fardad74 10-12-2016 03:05 AM

can't access Centos 7 apache server default page (Server not found) Reply to Thread
 
that rm -rf command i didn't run , my friend said if any prevoius alteration you made run it do delete that, so i'm trying first time httpd and just installed it so i skipped that command!

Jjanel 10-12-2016 03:07 AM

That's your webserver replying! Cool! (research "telnet localhost 80" on the web!)
I think you need a space after the GET, before the / (GET / not GET/)
Now=next, put in a 'homepage' (to GET ... default is index.html). This should get you started as a 'webmaster'! Do you have a web-browser on your centos?

While that tcpdump was running, try the 'win firefox'. Then, add -i eno16777736 and try on win again.

tcpdump -i eno16777736

(sorry, I wish I knew vmware networking 'bridge magic'. I use VirtualBox [on my XP host]...)

Jjanel 10-12-2016 03:40 AM

by the way, I hope you're using actual .2. (on 'win firefox', not the example .1. net in OP):
"when I type http://192.168.2.128 in firefox in windows ..."

One more ...: see if win host can still ping centos guest with virbr0 down [other 192.168.122. net]:
win> ping 192.168.2.128 (to make sure it's still working)
# ifconfig virbr0 down
win> ping 192.168.2.128 (to see if it stops working)
IF it still works[!], try=check the 'firefox ...' (just in case it works now)
Assuming the ping stopped working,
# ifconfig virbr0 up; ifconfig (to check it's back)
win> ping 192.168.2.128 (to make sure it's back working)

This will confirm that something is going on with the ..122. that I don't understand.
Look at the *win host* `netstat -rn` What device is 192.168.2.2?

You're learning the basics of IP routing, and at least now have CLI access to your webserver
(while waiting for more expertise on the vmware networking). Also, you now have some webserver logs to study/learn.

Fardad74 10-12-2016 04:06 AM

Quote:

Originally Posted by Jjanel (Post 5616888)
by the way, I hope you're using actual .2. (on 'win firefox', not the example .1. net in OP):
"when I type http://192.168.2.128 in firefox in windows ..."

One more ...: see if win host can still ping centos guest with virbr0 down [other 192.168.122. net]:
win> ping 192.168.2.128 (to make sure it's still working)
# ifconfig virbr0 down
win> ping 192.168.2.128 (to see if it stops working)
IF it still works[!], try=check the 'firefox ...' (just in case it works now)
Assuming the ping stopped working,
# ifconfig virbr0 up; ifconfig (to check it's back)
win> ping 192.168.2.128 (to make sure it's back working)

This will confirm that something is going on with the ..122. that I don't understand.
Look at the *win host* `netstat -rn` What device is 192.168.2.2?

You're learning the basics of IP routing, and at least now have CLI access to your webserver
(while waiting for more expertise on the vmware networking). Also, you now have some webserver logs to study/learn.

on both cases (with and without virbr0) ping worked on windows --> ping 192.168.2.128
i think problem it's not because of virbr0.

Fardad74 10-12-2016 04:32 AM

can't access Centos 7 apache server default page (Server not found) Reply to Thread
 
[root@localhost html]#
[root@localhost html]# telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /
<html>
<body>


<center> This is Fardad! </b> </center>




</body>

</html>

Connection closed by foreign host.
[root@localhost html]#

i tested on my centos firefox and showed "THIS IS FARDAD!" on both 127.0.0.1 and 192.168.2.128
i still have ping of 192.168.2.128 on my windows . i think the connectivity between win and centos have problem.


[root@localhost html]# netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 3087/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1767/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1770/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2935/master
tcp6 0 0 :::80 :::* LISTEN 9960/httpd
tcp6 0 0 :::22 :::* LISTEN 1767/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1770/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2935/master

Jjanel 10-12-2016 04:37 AM

You *ARE* a webmaster ;)

Oh! why not ipV4? Maybe 'normal' but I don't know, sorry...
maybe this [?] ... web-searching: tcp6 LISTEN httpd
...likely ok/normal.
Check with like putty on win: Does [host->guest] ssh work?

Fardad74 10-12-2016 04:51 AM

Quote:

Originally Posted by Jjanel (Post 5616909)
You *ARE* a webmaster ;)

Oh! why not ipV4? You've almost solved it, maybe/hopefully!

(check with like putty on win)

i'm using puTTY currently . i think one thing on my windows doesn't allow tcp out connections. but it's strange that i have ping of centos 192.168.2.128 and while my windows is 192.168.2.1 , both are in same subnet so that they should ping each other. I Really don't know why i can't see my sample page i created on my windows firefox!!!! while trying: http://192.168.2.128
is i doing wrong?? my brain exploding:cry:

after loading so much windows firefox says: The connection has timed out

Fardad74 10-12-2016 04:55 AM

Quote:

Originally Posted by Jjanel (Post 5616909)
You *ARE* a webmaster ;)

Oh! why not ipV4? Maybe 'normal' but I don't know, sorry...

(check with like putty on win)

i don't know , i just installed httpd and then started this service , by default when i run netstat -nlpt it showed that v6!

Fardad74 10-12-2016 05:00 AM

1 Attachment(s)
...


All times are GMT -5. The time now is 03:57 PM.