LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-27-2012, 04:01 AM   #1
piyushsingh
LQ Newbie
 
Registered: Sep 2012
Posts: 21

Rep: Reputation: Disabled
apache server with static ip can be access globaly


PLEASE HELP ME...I AM IN BIG TROUBLE...
I HAVE CONFIGURED APACHE SERVER IN RHEL 6 THAT CAN BE ACCESSED LOCALY I HAVE ISP.MY STATIC IP IS 59.177.X.X AND MY LINUX MACHINE TAKES 192.168.1.3 ..I WANT TO MAKE AN APACHE SERVER THAT CAN BE ACCESS GLOBALY ..PLZZ HELP ME.I HAVE ALSO DONE THIS FOR PORT FORWARDING
'iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080'.AND I HAVE ALSO CHANGED IN /etc/httpd/conf/httpd.conf LISTEN 8080.
please help me guys i am in big trouble.my mind is not working now
 
Old 09-27-2012, 09:39 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
If you have any routing device in between ISP modem and your server, just do the NATing with your Local IP and Public IP.
 
Old 09-27-2012, 10:28 PM   #3
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
After DNAT Forwarded Packets to Apache must be allowed by the firewall

Code:
iptables -A FORWARD -p tcp -i eth0 -o eth1 -d 192.168.1.3 --dport 8080 --sport 1024:65535 -m state --state NEW -j ACCEPT
iptables -A FORWARD -t filter -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
I am assuming
Router's Eth0 is connected to Internet. Eth1 is connected to internal Network. Apache server is behind the Linux router running firewall.
IP for apache web server is 192.168.1.3


Quote:
i am in big trouble.my mind is not working now

Do not type in capital letters.If you are in big trouble then stop working on Linux Box immediately. Other wise you would be even in bigger trouble. Because your mind is not working and without working mind can you fix the issue? So take some time for rest. When the mind is not working in trouble it is even more important to stop working immediately and start thinking first. So let your mind work only start working after that.

Good luck

Last edited by KinnowGrower; 09-27-2012 at 10:30 PM.
 
Old 09-27-2012, 10:35 PM   #4
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
You can also try to replace your PREROUTING RULE with this
Code:
iptables -t nat -A PREROUTING -p tcp -i eth0 -d xx.xx.xx.xx(Public IP of Router by ISP) --dport 80 --sport 1024:65535 -j DNAT --to 192.168.1.3:8080
 
Old 09-28-2012, 06:15 AM   #5
piyushsingh
LQ Newbie
 
Registered: Sep 2012
Posts: 21

Original Poster
Rep: Reputation: Disabled
i have done all this ..again when i am trying to open http://59.177.x.x:8080 it is not openinig ..please help me .
 
Old 09-28-2012, 05:37 PM   #6
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
you dont need to put port 8080 in url. http://59.177.x.x is sufficient. Most important is, you wont be able to do that from inside your network. To understand all this click this link Apache behind NATED firewall

Did it working locally? Show firewall rules as well

Last edited by KinnowGrower; 09-28-2012 at 05:39 PM.
 
Old 10-02-2012, 08:39 AM   #7
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
first change again it to port 80 and Try to open
http://59.177.x.x:80

Tell me what is it respond when you open only your static IP url that is http://59.177.x.x

Do you get the page saying "Apache 2 Test page"
This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that the Apache HTTP server installed at this site is working proper.

Method -II
**********
Add following line in /etc/httpd/conf/httpd.conf
ServerName localhost

and restart apache using
service httpd restart
 
Old 10-02-2012, 11:45 PM   #8
piyushsingh
LQ Newbie
 
Registered: Sep 2012
Posts: 21

Original Poster
Rep: Reputation: Disabled
thanks a lot dude...my apache server is workin fine localy ..plz help me to make it globaly
 
Old 10-03-2012, 12:43 AM   #9
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
You did not tell me, what happened if you open your static public IP?
http://59.177.x.x:80
or
http://59.177.x.x

Try this
********
Open firewall configuration, system -> Administration -> firewall
enable it for http port 80

In /etc/httpd/conf/httpd.conf
#Listen 127.0.0.1:80 :- Comment this line.
Listen 80 :- Uncomment this line.

Restart httpd
$ service httpd restart

Last edited by fortran; 10-03-2012 at 12:50 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache server with static ip can be access globaly piyushsingh Linux - Newbie 7 09-28-2012 02:07 PM
Apache server with Static ip is not working piyushsingh Linux - Newbie 4 09-08-2012 09:04 AM
Unable to access the server with static IP narendravijayarao Ubuntu 20 10-02-2009 11:31 AM
Using Apache server with non-static IP address issue coldbeer Linux - Server 2 07-06-2007 08:09 AM
can't access ftp server outside my LAN, fc4, ipcop, and static IP dazaau Linux - Networking 5 03-19-2006 09:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration