Solved

Open port 80 on RHEL 5

Posted on 2009-06-28
3
2,602 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you, everything worked exactly the way you indicated.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

763 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

12 Experts available now in Live!

Get 1:1 Help Now