Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Apache Trailing Slash Problem (FDQN config help...)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Thu Dec 31, 2009 8:02 pm    Post subject: [SOLVED] Apache Trailing Slash Problem (FDQN config help...) Reply with quote

Hello!

I'm setting up a LAMP server with Gentoo and I've just noticed some differences in behavior from my old configuration (Ubuntu).

When I type in a path on my server to show a directory, I need to append a '/' on the end or else Firefox (3) will give me a "Problem loading page/Firefox can't establish a connection to the server at localhost" error.

eg) "http://ipv4:port/Path_to/Dir" must be "http://ipv4:port/Path_to/Dir/"

I'm pretty sure that the problem is just something I neglected to configure in apache (2.2). Does anyone know of a way so that one can leave out the slash and still get the directory listing?

Thanks in advance! (I can't wait until this is fully functional. :P)


Last edited by ZHQ on Fri Jan 01, 2010 10:03 pm; edited 2 times in total
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Fri Jan 01, 2010 6:58 pm    Post subject: Reply with quote

Heh, it's me again. (Happy New Year!)

I've redoubled my searching efforts and I found that this problem is called the "Trailing Slash Problem". From what I know, it's caused when someone types in a url that doesn't end in a slash and the server automatically redirects the user to the same url with the slash appended. The new url will be incorrect because the server has an incorrectly configured FQDN (Fully Qualified Domain Name). I've renamed the subject to reflect that.[/code]

So it seems that (at least for now) my problem actually lies in the network configuration. I've always had trouble with the FQDN, especially with Ubuntu. A lot of places assume you already know the FQDN and tell you where to write it in (but not what to write or how to find out what to write). This is worse when you don't have your own domain name... It's finally caught up to me! T_T

From what I know so far, the hostname should be your ip address aliased to whatever you want in the /etc/hosts file and the domain name should be whatever your isp has (find this out with a nslookup query?)

After some searching, this what I have:

Code:

#/etc/hosts
...
# IPv4 and IPv6 localhost alias
127.0.0.1           localhost
::1                    localhost
ipv4                  ipv4 localhost ZHQServer
...


Could someone make sure this is correct?

I've gotten this: "A DNS reverse lookup shows your hostname as ip[ipv4].somewhere.domain.com." from the bottom of this page: http://www.kloth.net/services/nslookup.php

I've copied the information into /etc/hosts from the above page. I just have a question about the "ip" part. I'm not sure if it's just the page's quirky formatting or if it's actually part of the hostname...

Thanks again!


Last edited by ZHQ on Fri Jan 01, 2010 10:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Fri Jan 01, 2010 9:58 pm    Post subject: Reply with quote

I figured out a solution!

I have my server listening to a non-standard (ie, not port 80) port so I need to include that in my host name.

My actual configuration is this:

hostname: ipv4:port
dnsdomainname: somewhere.domain.com

so in /etc/apache2/vhosts.d/00_default_vhosts.conf
after ServerName I put:

ServerName ipv4:port.somewhere.domain.com

This fixes the trailing slash problem. However, I feel that this still seems a little clunky. It seems like I can put an alias like "ZHQServer" after ServerName and then have /etc/hosts or /etc/conf.d/net or something contain ipv4:port.somewhere.domain.com so the server can just replace it when needed...

Anyway, I hope this helps someone!
Back to top
View user's profile Send private message
Mistwolf
Tux's lil' helper
Tux's lil' helper


Joined: 07 Mar 2007
Posts: 108
Location: Edmonton, AB

PostPosted: Fri Jan 01, 2010 10:03 pm    Post subject: Reply with quote

Quote:
I've gotten this: "A DNS reverse lookup shows your hostname as ip68-9-244-200.ri.ri.cox.net." from the bottom of this page: http://www.kloth.net/services/nslookup.php

I've copied the information into /etc/hosts from the above page. I just have a question about the "ip" part. I'm not sure if it's just the page's quirky formatting or if it's actually part of the hostname...


your Cox' hostname is ip68-9-244-200.ri.ri.cox.net (yes, the ip IS part of the hostname). Just remember, if you are not on a static IP, your hostname will change when your external IP address changes (right now, based on your hostname, your external IP is 68.9.244.200).

With regards to setting up a FQDN, checkout http://www.gentoo-wiki.info/FQDN for a very basic guide.
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Fri Jan 01, 2010 10:06 pm    Post subject: Reply with quote

Ah. Thanks. It seems more helpful now that I've read up on it... :oops:
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1143

PostPosted: Sun Jan 03, 2010 9:29 am    Post subject: Reply with quote

You can assign your own FQDN if you only care to access your server from machines you control. Either add your arbitrary entry to /etc/hosts on each applicable machine, or run your own local DNS server which serves said arbitrary DNS entries (if you use a router with something like Tomato, you can do this automagically with static DHCP leases). So, if your arbitrary FQDN is a.b.c, then put a.b.c in for ServerName in your Apache config and problem solved.

The only difference between "having your own domain" and making one up is in the former case, everyone can resolve that domain, in the latter case, only you can.

Edit: Furthermore, any particular machine can have an arbitrary number of FQDNs, not just one.
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum