LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-05-2011, 11:20 AM   #1
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Rep: Reputation: 0
Setup home web server to public


I've setup my home desktop as a webserver (For testing purpose). I've opened up to the public by configuring port forward in my router. I checked with my friends and realised some of them couldn't access it. At first I thought the nameserver haven't propagate my domain info to the world. But now I realise that my ISP block port 80. Strange thing is some of my friends and I were able to access it.

Anyway, I wanna change the port number from 80 to 8140. So i opened up httpd.conf, and changed to 'Listen 8140' and in the virtualhost settings I set it to:

Code:
<VirtualHost *:8140>
ServerName example.com
DocumentRoot /var/www/html/example
RewriteEngine On
</VirtualHost>
Initially while changing the port number, i encountered this error when restarting httpd:

Code:
Permission denied: make_sock: could not bind to address [::]:8140
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8140
no listening sockets available, shutting down
Unable to open logs
So I keyed in the following commands in the terminal and it works:

Code:
semanage port -a -t http_port_t -p tcp 8140
service httpd start
In my linksys router config, I went to Applications and Gaming > Port Range Forward and key in the following info for port forwarding:

Code:
Application | Start | End | Protocol | IP Address | Enabled
Example | 8140 | 8140 | TCP | 192.168.1.102 | Checkbox checked
I restarted apache a few times and I still can't access my web example.com:8140 on the browser. However, I was able to access it locally on the webserver with 127.0.0.1:8140

In my nameserver settings, I've set my A records to be:

Code:
Name | IP
example.com. | 112.8.8.1
Where did I go wrong??
 
Old 10-05-2011, 06:38 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Check to ensure apache (httpd) is listening on all interfaces not just localhost - 'netstat -tnlp' as root
 
Old 10-06-2011, 09:29 AM   #3
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
hi,

yup httpd is listening to all port. i did netstat -tnlp and i get:
tcp 0 :::80 :::* LISTEN 8706/httpd

do i need to key in the port number for the A records?
 
Old 10-06-2011, 05:53 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
No, A records do not include port information. Do you have another machine on the same network that you can use to test access to the site? ... this will rule out the host as the problem source.
 
Old 10-06-2011, 07:05 PM   #5
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
yup i got another computer actually. two comps actually =D. but i cannot access example.com:8140 and with the local ip 192.168.1.102:8140 but i can ping 192.168.1.102. but as mentioned, i was able to go to 127.0.0.1:8140 on the host machine itself

Last edited by nuttynibbles; 10-06-2011 at 07:13 PM.
 
Old 10-06-2011, 07:25 PM   #6
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 648

Rep: Reputation: 78
I know this may be a dumb question, but is your servers ip address 192.168.1.102? If it's not set as a static ip. The other computer may have taken that IP from it giving you an unaccessible webserver.
 
Old 10-06-2011, 07:42 PM   #7
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
hi bret381, lol it's not a dumb Q.

anw 192.168.1.102 is the local address in my network. My other computers are 192.168.1.101 and etc. My public ip is dynamic though. but from the router administration status, i could see it didn't change for the past 2 weeks.

To make things more complicated, if i change the port back to 80, i'm able to access example.com from my other computer. however, most friends outside my network cannot access except for 1 which im not sure why. so i suppose my isp block port 80

Q is should I able to access the web server within the local network with 192.168.1.102:8140 from my other computer @ 192.168.1.101??

Last edited by nuttynibbles; 10-06-2011 at 07:43 PM.
 
Old 10-06-2011, 08:00 PM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
should I able to access the web server within the local network with 192.168.1.102:8140 from my other computer @ 192.168.1.101??
.. you'll probably need to add an entry to <windir>\system32\drivers\etc\hosts on 192.168.1.101:
Code:
192.168.1.102   example.com
 
Old 10-06-2011, 09:54 PM   #9
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 8,087

Rep: Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533
Quote:
Originally Posted by nuttynibbles View Post
To make things more complicated, if i change the port back to 80, i'm able to access example.com from my other computer. however, most friends outside my network cannot access except for 1 which im not sure why. so i suppose my isp block port 80

Q is should I able to access the web server within the local network with 192.168.1.102:8140 from my other computer @ 192.168.1.101??
Is port 8140 open in your router and set to forward to the correct machine?
 
Old 10-07-2011, 11:24 AM   #10
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
hi frankbell, yes i suppose i did open my port and allow port forwarding on 8140 correctly. i followed the steps for router settings @ http://versatile1.wordpress.com/2007...-for-utorrent/ but im using a dhcp for dynamic ip allocation for computers on my network. i guess that is fine as long my local ip dont change and it hasn't change since.
 
Old 10-07-2011, 11:53 AM   #11
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
okay i cleared my iptables and now it works.

i noe this is not a solution but im wondering what could be wrong with my settings. is there a way to check what were the settings i've cleared??
 
Old 10-07-2011, 12:48 PM   #12
nuttynibbles
Member
 
Registered: Apr 2010
Posts: 59

Original Poster
Rep: Reputation: 0
what i did is openup iptables and added accept port 81. restart iptables and it works
 
Old 10-07-2011, 07:58 PM   #13
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 8,087

Rep: Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533Reputation: 1533
I would suggest that you mark this thread as solved, so that others who might have similar problems can learn from it. And congrats.
 
  


Reply

Tags
apache, webserver


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Home Web Server accessed by Public IP splinux Linux - Server 13 07-12-2011 09:16 AM
Do you have a local or public server at home? blahblalblah General 6 03-11-2011 02:48 PM
setup a home based LINUX web server vinnie_vinodh Linux - Newbie 7 05-10-2009 08:37 AM
To Setup Home Web server for my web site KinnowGrower Linux - Server 6 08-06-2008 12:08 AM
How might I Setup Home Web Server plus File Server plus Printer Sharing brindamo Linux - Server 3 01-14-2008 01:48 AM


All times are GMT -5. The time now is 10:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration