# Apache, router..

## SPo0n

Apache doesn't seem to let external connections work. It's all fine locally.

After searching i found this..

[quote="Nitro"]Are the requests actually hitting the webserver and just not coming back out of the router?  From a remote location telnet to it ie: 

```
telnet <ipaddress> 80
```

  If that connects, then we know you are getting to the server.  To request a web-page type "get /", you should get html.

If not, then I thLast edited by SPo0n on Thu Oct 10, 2013 10:55 pm; edited 2 times in total

----------

## sebest

You can use netstat -pant to check where you apache is listenting

(netstat -pant | grep apache)

you'll know which port and ip it's listening on

in your conf it seems to be listening on every ip on port 8080 (directive PORT and LISTEN)

For the problem you have when you start apache check that you have an entry in your /etc/hosts for your ip

Or define the ServerName directive in you apache config.

Hope that it may help

----------

## SPo0n

rggregLast edited by SPo0n on Thu Oct 10, 2013 10:54 pm; edited 1 time in total

----------

## easykill

 *SPo0n wrote:*   

> 
> 
> /etc/hosts contains:
> 
> ```
> ...

 

Probably not the issue, but it is generally a good idea to leave 127.0.0.1 as localhost

make Zinc (or whatever your local computer name is) be your IP, such as 

```
192.168.1.1     zinc
```

Also, it is a bit odd to have capitalization in a host name, but that's your choice.

----------

## SPo0n

I'm still getting connection refused. Changed my hostname to zinc and /etc/hosts to reflect this. also did my local ip (192.168.0.5). I still get connection refused. Other people do aswell so it's not my college's fault.

In my router's port forwarding page, i see an option for Default DMZ server. What's that? It's set to 0.0.0.0 right now. Also at the bottom there's a tickbox saying  "Respond to Ping on Internet WAN Port", what does this do? Will those 2 options affect my port forwarding

----------

## fatcat.00

If this was my problem, I would make sure that routing is working from the remote box to your web server.  A really simple way to do this is to try to ping your web server from the remote box.  If you get replys, you're good.

What is output when you run "hostname"?  Is it "zinc"?  If so, go ahead and make up a dummy domain for yourself and add it to the "/etc/hostname" file.  Do "env-update" and maybe restart networking.  Not sure which one inits your hostname.

If that still doesn't do it, then I would start with a really boneheaded apache.conf file.  The one that Gentoo installs by default seems to be a reasonable and working start.

Post more info once you do these things.

----------

## SPo0n

Ok the reason it's taken me a long time to reply is that i've reinstalled, and removed windows. Now only gentoo resides on this hard drive  :Smile: 

Earlier on, i emerged apache, mod_php, php and mod_ssl - left the config files default for now.

I've set my hostname to 'turbo' and the other thing is 'turbo.dummy.com'. Seems to load the default apache page now (if you see this apache is installed blahblahblah), from external connections. But if i try to access another directory then it tries to connect to turbo.dummy.com which of course doesn't exist. Now i don't own a domain or intend to own one any time soon. How am i meant to get this working?

----------

## splooge

put turbo.dummy.com into your /etc/hosts file.

If you're using a MS box the hosts file can be found in

\winnt\system32\drivers\etc if you're using 2k/xp or c:\windows in 95, 98, etc.

----------

## SPo0n

why would i be using a windows box - and posting questions here? 

```
# /etc/hosts:  This file describes a number of hostname-to-address

#              mappings for the TCP/IP subsystem.  It is mostly

#              used at boot time, when no name servers are running.

#              On small systems, this file can be used instead of a

#              "named" name server.  Just add the names, addresses

#              and any aliases to this file...

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.7 2002/11/18 19:39$#

                                                                                

127.0.0.1       localhost

192.168.0.5     turbo.dummy.com         turbo

```

That's my /etc/hosts. I set turbo.dummy.com to my internal IP, it doesn't work

----------

## splooge

Make sure that not only the server has that in its hosts file but make sure the maching running the web browser has it too.  If the machine with the web browser can ping turbo AND turbo.dummy.com it should work just fine.  Unless you've setup vhosts then a little more configuration is involved.

----------

## handsomepete

I'm assuming he mentioned the Windows hosts location because you have to specify the IP/name in the hosts file on the computer that wants to access the server (so if you're using Windows 98 PC frank.dummy.com you'd specify 192.168.0.5 turbo.dummy.com in the Win98 hosts file).  Otherwise the accessing computer will have no idea how to resolve turbo.dummy.com other than the usual (DNS server) way.  

Besides that, I've seen a small number of Windows users asking general questions here and in IRC.   :Smile: 

----------

## SPo0n

hheethhLast edited by SPo0n on Thu Oct 10, 2013 10:54 pm; edited 1 time in total

----------

## splooge

Now that is really strange =(

What happens if you browse with the IP address instead of the hostname?  Can you access different directories?

----------

## handsomepete

 *SPo0n wrote:*   

>  *splooge wrote:*   Make sure that not only the server has that in its hosts file but make sure the maching running the web browser has it too.  If the machine with the web browser can ping turbo AND turbo.dummy.com it should work just fine.  Unless you've setup vhosts then a little more configuration is involved. 
> 
> well it seems to work..
> 
> ```
> ...

 

I apologize ahead of time if this comes off as dickish.  You're still pinging it from the server (at least I'm assuming you are since your prompt says jamie@turbo).  You need to put the entry into the hosts file on the other computer you want to access the server from, otherwise the other computer will continue to try to go out to the internet.  Try accessing it by IP (http://192.168.0.5).

----------

## SPo0n

I don't need local access to websites, i need external access - ie from computers outside of my network/router.

----------

## handsomepete

So you need a way for people to access you outside of your network?  Are you doing it on a school network (just asking because of the Suse comment on the first post)?  If that's case, it might be a little more difficult.  People outside of the school probably won't have a way to get to your router.  People inside the school network will, but setting that up is very dependent on how they do their network.  

If you're just doing it on a cable/DSL line, then just log into your router, see what IP your provider gave you, and do as stated above with the hosts file with the provided IP (edit - on the client side, you don't need to set your server's IP to the provided one).  If your provider doesn't give you a static IP, then there are a lot of various ways for you to handle that (others would be better at explaining that than me, though).  All this is assuming that your provider doesn't block inbound port 8080 (as a lot of people use this to get around the port 80 blocks  :Smile:  ).  Good luck.

----------

## splooge

 *SPo0n wrote:*   

> I don't need local access to websites, i need external access - ie from computers outside of my network/router.

 

Yes, we know, that's our point.

You're pinging it from the WEB SERVER.

The CLIENT needs to be able to ping BOTH turbo and turbo.dummy.com which has NOTHING to do with the /etc/hosts file on the server (unless your web browser is on the server, which you haven't clarified for us yet).

Now answer our question please:  Can you browse it via IP address instead of host name?

----------

## fatcat.00

In order for remote hosts to access your machine's web server they need to first be able to resolve a name to your machine's address.

Adding things to your machine's /etc/hosts file won't accomplish this.  Your choices are:

1) Get a name for your machine entered in your school's DNS or

2) Add your machine's name and IP to every remote machine's /etc/host file (not practical) or

3) Have every remote machine browse to your machine by entering "http://123.123.123.123" (subsitute your machine's IP address, of course).

Of these, #1 is the best choice, with #3 a distant second place, and #2 is pretty unlikely unless you control the remote machines.

----------

## SPo0n

egmegomm!Last edited by SPo0n on Thu Oct 10, 2013 10:55 pm; edited 1 time in total

----------

## splooge

I was able to get to your web site at:

http://81.103.137.97

However I couldn't get to http://81.103.137.97/manual/ due to a permissions issue.

After I put turbo and turbo.dummy.com in my hosts file, I can access your web site just fine (aside from the permission error on /manual/ ) using http://turbo/ or http://turob.dummy.com/

Everything looks OK.  Just point your dyndns account to this IP address and you can go from there.

----------

## SPo0n

well i me.Last edited by SPo0n on Thu Oct 10, 2013 10:55 pm; edited 1 time in total

----------

## splooge

http://jsamat.homelinux.net works too.

What was the problem again?  ;p

----------

## SPo0n

it wasn't working before   :Embarassed: 

----------

