Link to home
Start Free TrialLog in
Avatar of foreverdita
foreverdita

asked on

Need help setting up Linux Server as web server #1 - remote access

I have a Linux running red hat enterprise.  Right now, the way it is configured, I can get out to the internet with this server, but I cannot get remote access to the server through remote desktop or vnc.  It is not responding.

The server does not sit behind a firewall, and should be accessible by IP address, but it is not right now.

This problem will be a multi-part question worth over 2000 points in the end, so anyone to help can REALLY help me.

The first step is to get the server accessible from the outside remotely, so I can do more setup from a remote area.  Can someone help me get this server online so that it can be accessed remotely?

Thank you!
Avatar of foreverdita
foreverdita

ASKER

Also, when I ping the server with IP, I do get a reply.  I just can't access the site through IP or even remote desktop or vnc to it.

I can also putty into the server.
So, if there is a way to check config to make sure internet and apache is connected correctly, I can putty into the site and work that way if someone can guide me.
For simple remote access, you don't require Apache.

For internet access, you need to be running Apache.
first of all,
- you need to see whether Apache is running as a serice or not.
ps -ef | grep -i apache
will tell you that.
so you can ping the server and ssh to it...sounds like you're able to access it after all. Did you install and run the vncserver on the machine? Anyway, there's no reason that you can't do all the config using ssh.

since you're running RHEL, the apache process is not called apache, run this instead:
ps -ef | grep httpd

that will tell you it the webserver is running.
if it's not, run:
chkconfig --level 345 httpd on
then:
service httpd start

then try the first command again, and see if httpd is in there.

now you can try to load up the test page in your browser (assuming you haven't loaded a new index.html yet?). the index page should go in /var/www/html, assuming you installed everything and haven't changed the config yet.

check back once you've got the server running....and you should probably install iptables or another firewall to protect your machine as well...

#ps -ef | grep httpd
root      2528     1  0 Mar09 ?        00:00:01 /usr/sbin/httpd
apache   27200  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27201  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27202  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27203  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27204  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27205  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27206  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
apache   27207  2528  0 Apr10 ?        00:00:00 /usr/sbin/httpd
root      1517  1484  0 09:35 pts/1    00:00:00 grep httpd
httpd is on, but I still cannot access the server through ip address, even though I can putty into it.

VNC is already installed, but I cannot access it through VNC either.

did you try configuring httpd.conf yet? have you put any web content on the server?

if not, you should at least get the default page

2 things I'd try...

1) verify you can get to port 80 on the machine
- you could do 'telnet 80 <ip of the server>' to make sure you can get to it from your system. If it answers, type GET and see if you get any response

2) ssh into the machine
check for lynx or links
'which lynx'
if it's installed on there, do 'lynx <hostname>' and see if it loads the sample web page for you

3) ssh in, and run 'httpd -t' to check for any syntax errors in the httpd.conf file
When I was on the server locally, and typed in the IP address, it gave me my webpage.

But when I try to access it remotely through a web browser, I get an error page "Can't find server".

I cannot telnet into port 80 of the machine.

How do I check for links or lynx?

Sorry I am such a novice at this stuff - I'm used to working with Windows.
httpd -t gives me nothing:  

[root@65-42-106-8 ~]# httpd -t
[root@65-42-106-8 ~]#
C:\Documents and Settings\dita>telnet 80 65.42.106.8
Connecting To 80...Could not open connection to the host, on port 65.42.106.8: Connect failed

This is what I get when I try to telnet to the server from my local machine.

sorry, try the telnet like this:
telnet <ipaddress> 80

I had them switched...

re. lynx, type 'which lynx' and it will tell you if it's somewhere in your path. Then try 'which links' as well...they're both similar

RE telnbet - still getting same error.  could not connect.

Obviously something is not configured correctly with the port 80

RE lynx:

lynx is somewhere in my path - under usr/bin

same with links

It seems your port 80 is closed.
Can you post the output of

grep "^Listen" /etc/httpd/conf/httpd.conf
Listen *:80


is the output I get
The basic setup is this, just in case you would need this info to help me get started.

The ISP is SBC.  The server lies behind the Cisco router.  This server can get out to the internet with no problem.  When I was on the actual machine and typed in the ip address at the web browser, I got my main page.  From any server other than the actual server, I cannot access the main page.  It's totally driving me nuts.

Does your router have a setup which blocks request from outside world??
No - the router is strictly the Gateway outside.  No blocks or anything.  We have several other servers running with no problem, including a Red Hat 7.

ASKER CERTIFIED SOLUTION
Avatar of JammyPak
JammyPak
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, when the service iptables is stopped, I can access the server through the ip address.

How brilliant are you????????????

So what does this tell me?  Something is wrong with the IP table?



no, IPtables is a firewall...and you're running it :)

You could turn off the firewall (which you have), and then run 'chkconfig --level 345 iptables off' so it won't restart at boot. Or, you can change the rules to allow incoming port 80 to the server. If you run redhat-config-securitylevel (using X Windows) then that's likely the easiest, otherwise the iptables command line can be run over ssh

'iptables -L' will list all of the rules
'iptables -F INPUT' flushes all the incoming rules (so you'd might as well not run it...)

'iptables -D' will let you delete a specific rules, so if you find the one in the INPUT chain that mentions '-p tcp --dport 80' then that's the one you want to delete

Thank you for this solution.  Amazing that you knew that and I thank you thank you thank you!
thanks, but IPtables is pretty common, so watch out for it!