Solved

Open port 80 on RHEL 5

Posted on 2009-06-28
3
2,607 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
  • 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.

911 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

17 Experts available now in Live!

Get 1:1 Help Now