Solved

LINUX CENTOS + APACHE

Posted on 2016-11-25
9
63 Views
Last Modified: 2016-11-26
I just installed CENTOS 7 connected via SSH and installed apache like this:

yum -y install httpd

everything seems to be fine as when I run this command I can see that the apache is running

service httpd status

If I open the GUI via console, I run Firefox and the default apache home page comes up

but this is for a server and the users are going to connect over the LAN.

From a client computer in the same LAN I can ...
connect via SSH
ping the server
and it works.

but when I open firefox in the client computer and try to go to the Server IP it comes back with the error the site can't be reached.

I'm sure this has to be a very simple config but I don't know what is wrong, please help.

Thanks.
0
Comment
Question by:cargex
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41902035
You probably haven't opened port 80 in the firewall for external connections.
0
 
LVL 2

Expert Comment

by:Uwe Degenhardt
ID: 41902045
Did you try to clear the browser cache ? Have you tried another browser ? The same result ?
0
 

Author Comment

by:cargex
ID: 41902049
Dave,
I concur it could be the LINUX firewall.
I can disable the firewall on this server since it is going to be used internally only.

It's been a while since the last time I touched a LINUX server, so I did the following.

iptables stop
chkconfig iptables off

Unfortunately the problem persists.

Can you please suggest specific commands to solve the issue?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41902054
Without access to the server to check things, all I can suggest is restarting the server to see if it changes.  You can check the 'Listen' line in the 'httpd.conf' file to see if it is restricted to a particular IP address.  If you change anything in 'httpd.conf', you must restart Apache because that file only is read when Apache starts.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 24

Expert Comment

by:Dr. Klahn
ID: 41902090
Try doing a manual connect using telnet and see what the server has to say, if anything.  Substitute the appropriate values for the IP address and the domain name.

telnet 192.168.0.200 80
GET / HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

Open in new window


Then press Enter twice.  The server should respond with something like this:

HTTP/1.1 200 OK
Date: Wed, 21 Oct 2016 11:08:05 GMT    <-- optional
Server: Apache/2.2.36    <-- optional
Connection: close
Content-Type: text/html

Open in new window


If the server responds locally but doesn't respond to this basic test over the LAN, then there's an issue with the port configuration.
0
 
LVL 77

Expert Comment

by:arnold
ID: 41902438
Cents 7 uses firewalld.
Check httpd.conf to make sure it is not bound to localhost only
In the shell run netstat -an | grep ':80'
If it has 0.0.0.0:80 or *:80 listen this means it is bound to all available interfaces/ips
If it has 127.0.0.1:80 this means it is bound to localhost only

In httpd.conf search for listen and comment it out.
Presumably you did edit httpd.conf setting servername, etc. or was yum install httpd the only command you ran?
0
 

Author Comment

by:cargex
ID: 41902467
Hi Arnold,
I'm not familiar with the Apache installation.
So far only yum install httpd.

I have to connect to a remote site to make the changes, it will be greatly appreciated if you can list here all the changes needed after yum install httpd.

That way I can connect once to do all fixes.

Thanks
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 41902511
There are variations.
Run netstat -an to see whether the default is bound to localhost
Ifconfig -a to see the IPs
First thing check whether you use firewalld since iptables off did not resolve the issue.
chkconfig --list | grep -i firewall
service firewalld stop
Or better to add the rule
Firewalld-cmd --zone=public --add-service=80
Within /etc/httpd/httpd.conf
Look for LISTEN if should be commented out.

....
0
 

Author Closing Comment

by:cargex
ID: 41902638
Thank you very much Arnold.
The firewalld part did the trick.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now