Solved

LINUX CENTOS + APACHE

Posted on 2016-11-25
9
67 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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
 
LVL 25

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux haproxy: stop temporary haproxy service 9 41
centos linux 65 125
Red Hat 7 Linux on Azure cannot run a command as root 22 41
number in printf 13 27
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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

774 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