Solved

LINUX CENTOS + APACHE

Posted on 2016-11-25
9
36 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 82

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 82

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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 23

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 76

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 76

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

757 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

18 Experts available now in Live!

Get 1:1 Help Now