Solved

Open port 80 on RHEL 5

Posted on 2009-06-28
3
2,619 Views
Last Modified: 2013-12-15
Hi Experts

Total newbie in fiddling with serverr and was wondering how do I open port 80 on RHEL (launched on Amazon Web Services).
I ran a few codes and mostly got errors:

vi/etc/sysconfig/iptables
-bash: vi/etc/sysconfig/iptables: No such file or directory
/etc/sysconfig/iptables
-bash: /etc/sysconfig/iptables: Permission denied
/etc/services
-bash: /etc/services: Permission denied

Also there's indication that the port is not listening

netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:ndmp                      *:*                         LISTEN
tcp        0      0 localhost:ipp               *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN

netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

Regards,

Daniel
0
Comment
Question by:Daniel993
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 500 total points
ID: 24733222
Hi,

> vi/etc/sysconfig/iptables
> -bash: vi/etc/sysconfig/iptables: No such file or directory

The problem here is you've forgotten to add a space between the command (vi) and the Parameter (filename). Try to launc it such as this:

vi  /etc/sysconfig/iptables


> /etc/sysconfig/iptables
> -bash: /etc/sysconfig/iptables: Permission denied

The problem is the file you're trying to launch is not a shell script so you can not launch it by calling the file directly. In fact the file /etc/sysconfig/iptables is simple a configuation file to the iptables service. Try to launch it :

service iptables start

To query if it is alrady running with a command suche as this:

# iptabes -L


> /etc/services
> -bash: /etc/services: Permission denied

/etc/services is a file that lists the service port numbers. So it was accessed by a service to learn what port it should connect. So you can not laonch the file from the command line like that.

If you want to start apache you need to activate the service first. And then you'll start it with these commands:

chkconfig --list httpd

if it responds by:

httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off

it means that the service is inactive. Then activate it when the system reboots issue this command:

chkconfig httpd on

now the output of chkconfig  --list httptd should be:
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

Now that we're sure that it is enabled for next reboot we need to launch the service with this command:

service httpd start

Cheers,
K.

0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24733233
If you get this when you run apache:

# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for HOSTNAME
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]

It means that the servername is not correctyk set in /etc/hosts then edit it and change this:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost HOSTNAME
::1             localhost6.localdomain6 localhost6

and edit thefile to be such as this:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
x.x.x.x                   HOSTNAME.example.com HOSTNAME
::1             localhost6.localdomain6 localhost6

Where x.x.x.x is your eth interface IP address
HOSTNAME is your actual hostname.




0
 

Author Closing Comment

by:Daniel993
ID: 31597703
Thank you, everything worked exactly the way you indicated.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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