Setting up apache web server behind a router

Steve Reilly sfreilly at roadrunner.com
Tue Jun 9 00:37:04 UTC 2009


Marco Segreto wrote:
> Steve Reilly wrote:
>> Marco Segreto wrote:
>>   
>>> I have Ubuntu 8.10 server set up on my network which is connect to the 
>>> internet through a linksys router. I wanted to be able to access 
>>> websites on my server but need to go through a port besides 80 because 
>>> the router blocks this port. I've enabled port forewarding on port 8080 
>>> on my router and have set up a static IP for my linux machine. When I 
>>> try and connect to my server with myserver.net:8080 it still times out. 
>>> I'm pretty sure I set up everything correctly though.  Here's my 
>>> ports.conf file in the apache2 folder:
>>>
>>>    NameVirtualHost *:80
>>>    Listen 80
>>>    Listen 8080
>>>
>>> <IfModule mod_ssl.c>
>>>    #
>>>    #
>>>    Listen 443
>>> </IfModule>
>>>
>>> I tried switching to VirtualHost *:8080 as well as changing it in the 
>>> default file in the sites-available folder but it didn't work either. 
>>> I've done this before on my Hardy system and I had no NameVirtualHost 
>>> option so I'm not really sure why it's there now.
>>>
>>>     
>> does your /etc/apache2/sites-available/default   look like this?
>>
>> NamevirtualHost *:80
>>         <VirtualHost *:80>
>>         ServerName mysite.com
>>         ServerAlias mysite.com
>>         ServerAdmin sfreilly at roadrunner.com
>>         DocumentRoot /var/www/serendipity
>>         CustomLog /var/log/apache2/mysite-access.log common
>>         </VirtualHost>
>>
>> but with the port changed to 8080?  and have you restarted apache for
>> changes to take effect.
>>
>>
>> steve
>>   
> 
> I set up my sites-available/default like said above and still no luck. I 
> can connect to the site from my linux machine with the command:
> 
>  lynx localhost:8080 
> 
> OR
> 
> lynx mysite.net:8080
> 
> I still can't connect to the site from another computer though. I'm 
> using dyndns to attach a domain name to my ip address as well. I can use 
> the domain name to connect to my server with ssh but I can't see the 
> webpage in a browser. I also restarted apache with
> 
> etc/init.d/apache2 reload. 
> 
> Theres other things in the sites-availabe/default file that I didn't 
> touch like <Directory /var/www/> or <Directory "/usr/share/doc/">. Could 
> part of it be causing a problem?
> 
> Marco
> 
> 
> 
> 
not 100% sure about the other stuff in "default" (i dont have anything
in there but virtualhosts for other websites) but if you cant get to the
webserver from outside the router with a browser id say either one of 2
things are wrong.  your isp blocks the port or all ports or your port
forwarding isnt set up correctly in the router?

is it setup to forward port 8080 to the internal ip of your webserver?

from your internal network can you get the website by calling it with
internalIP:8080?

PS. whatever changes you make in sites-available you also ave to make in
sites-enabled as well.



steve





More information about the ubuntu-users mailing list