# Access Apache Behind Router

## rawbeefman

Hey guys;

My problem involves getting apache to serve pages outside of my local network.  Everything currently works as it should inside.

I want to bind apache to port 8080 since port 80 for some reason serves some pages related to my ooma device.  Looks like that may be some security glitch, but I will investigate later ...

Internet connection goes from modem, ooma, router, switch then to the server box.

I logged into the linksys router setup (is there a name for that? ... firmware, web frontend?) and modified the Single port forwarding page by adding

Application Name: HTTP_2

External Port:  8080

Internal Port: 8080

To IP Address: 192.168.1.100 (which is a static internal ip referencing my server

Enabled:  True

My code is located at /var/www/localhost/htdocs/Project_1/

I then modified my vhost file; which I believe is my issue, since it is really the only thing I dont understand.

```
#nano /etc/apache2/vhosts.d/00_default_vhost.conf
```

I added the following to the vhost file:

```

Listen 192.168.1.100

Listen 8080

<VirtualHost *:8080>

        DocumentRoot /var/www/localhost/htdocs/Project_1/

        ServerName 192.168.1.100

</VirtualHost>

<VirtualHost *:8080>

        DocumentRoot /var/www/localhost/htdocs/Project_1/

        ServerName a.b.c.d

</VirtualHost>

```

(Where a.b.c.d is my outside ip address)

I am attempting to access the page by visiting http://a.b.c.d:8080/index.html, meaning I am attempting to bind that particular project to port 8080

And this might help:

```
#ls -l /var/www/localhost/htdocs/Project_1/

-rw-r--r-- 1 root root 1202 Oct 24 21:49 index.html
```

I hope this is thorough enough for someone to point me in the right direction.

Thanks!

 Ehren.

----------

## lexflex

Hi, 

Maybe first check if the webpage works from inside your network (using http://192.168.0.100:8080/index.html)

Make sure it does, and only then try from the outside.

Alex.

[quote="rawbeefman"]

Application Name: HTTP_2

External Port:  8080

Internal Port: 8080

To IP Address: 192.168.1.100 (which is a static internal ip referencing my server

Enabled:  True

----------

## rawbeefman

Interesting; when I run http://192.168.1.100/proj1/index.html I am able to access my page.

However, running http://192.168.1.100:8080/index.html, I get a 403 - You don't have permission to access /index.html on this server.

I am going to play with options in my vhost file.  Might you have a good reference?  The file itself is excellently commented, but I have always been more of an example person myself.

Thanks for the reply and the help!

 - Ehren.

----------

## lexflex

 *rawbeefman wrote:*   

> 
> 
> However, running http://192.168.1.100:8080/index.html, I get a 403 - You don't have permission to access /index.html on this server.
> 
> 

 

This might be a permission-problem of that specific file index.html. Check if the apache-server has rights to read it You can use chown to give ownership to the Apache-server or chmod to add permissions.

On your original post:

-The settings look right ( but each router/modem has its own quirks); However, I had trouble with something similar because my router got confused by the port-numbers: Maybe try 8081 from outside, and forward it to 8080 to make sure there can be no mix-ups.

-Also, make sure you really try from the outside ( and not just from inside by using your external IP...)

Hope this helps,

Alex.

----------

## solamour

When "http://192.168.1.100:8080/index.html" works, make sure to go to Ooma's configuration screen ("http://setup.ooma.com") and forward 8080 to Server as well.

```
Internet -- Modem -- Ooma -- Router -- Switch -- Server
```

__

sol

----------

