Jump to content
The Uniform Server Community
Sign in to follow this  
gratzo

browsing "live" US from same machine as server is running on

Recommended Posts

Trying to figure out if I'm doing anything wrong, or if this is the way that US works locally, and also from outside of the network.

 

I have US v3.3 running on a local machine just fine - with several test folders:

 

www/test1

www/test2

www/test3 etc.

 

The subdomain and domains are set up with GoDaddy, and I'm using the Total DNS tool to point the subdomain that I created to my static IP.

 

I'm using real/live domain names, so the examples below are for demonstration purposes only!

 

I have virtual host activated, and have assigned the variables with the following:

 

NameVirtualHost *:80

 

<VirtualHost *:80>

DocumentRoot /www/

ServerName localhost

</VirtualHost>

 

<VirtualHost *:80>

DocumentRoot /www/test1

ServerName my-subdomain.my-domain.com

</VirtualHost>

 

When I browse to "my-subdomain.my-domain.com" from a machine OFF of my network (I happened to use my work laptop that is VPN'd, so it appears as it's from another part of the world), everything is served great. All goodness comes to an end if I try to browse to the same site from my browser that the UniformServer is residing on. (same machine)

 

What is weird is that if I open FireFox, browse to the same URL ("my-subdomain.my-domain.com"), it gets me to my router, and won't pass through to the server - the router (I assume) creates a redirect and tries to open the admin page for 192.168.1.1 (my router). I get served my router admin page!! Remember, I know that the router is actually passing http traffic as I can get to the US from "outside" my network....

 

I have Verizon DSL, for some unknown reason I've had the same IP address for 6 months so I'm treating it as static (even though it's dynamic), and they supply the DSL router/modem/switch in an all in one unit. (I had a Cisco/Linksys before that had a little bit better control over port mapping, etc).

 

So, in other words, if I try to browse "locally", from any of the machines to the actual URL ("my-subdomain.my-domain.com"), I get my router admin page served. If I browse from "outside of the network", everything is served fine.

 

I can locally browse the US's machine IP "192.168.1.106/test1" from any machine on the network, and get the site.

 

Is this just a function of how domain names are served locally when using virtual hosts? Am I doing something wrong, or trying to do something that I shouldn't actually be doing?

 

Your virtual host/subdomain/router expertise greatly appreciated!

Share this post


Link to post
Share on other sites

I have read your post several times and cannot see anything wrong with your set-up, what you are observing is a limitation of your router.

 

You are accessing your website/s by name from behind your router from PCs on your internal network. Problem is, many routers automatically assume a web connection to itself from inside your network is an attempt to log into the router's configuration interface. Your router is probably one of these (not sure because I am not familiar with the one you are using).

 

“I can locally browse the US's machine IP "192.168.1.106/test1" from any machine on the network, and get the site.”

 

I assume that’s true for IP "192.168.1.106/test2" and IP "192.168.1.106/test2" etc.

 

As for external access “I happened to use my work laptop that is VPN'd, so it appears as it's from another part of the world” that looks OK another method to test external access is to use Google Translate http://www.google.com/translate_t?langpair=fr|en at the bottom of this page enter your sub-domain names. If the page gets translated it is accessible.

 

“Is this just a function of how domain names are served locally when using virtual hosts? Am I doing something wrong, or trying to do something that I shouldn't actually be doing?”

 

It’s not a function how domains are served using virtual hosts. I am sure you are not doing anything wrong. What you are attempting is logical.

 

If you do want to access your sites locally add entries into the host file so the domains can be resolved for example:

 

On the local machine (where the server is running) add to the end of the host file:

127.0.0.1 my-subdomain.my-domain.com

127.0.0.1 my-subdomain2.my-domain.com

127.0.0.1 my-subdomain3.my-domain.com

 

On the other PCs

192.168.1.106 my-subdomain.my-domain.com

192.168.1.106 my-subdomain2.my-domain.com

192.168.1.106 my-subdomain3.my-domain.com

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Ric - that worked! Thanks a ton! But now after doing this change, something strange just started - I have 7 test folders on the server, test1, test2, etc. - 4 of them are WordPress installs, and a couple are random web pages, photo albums, etc. What just started happening was I get a 403 Forbidden error on all folders that do NOT have an .htaccess file in them.

 

This is plain weird!

 

I had copied completely the server a while back, saved it on my desktop - so I thought, hmmm, when I started fooling around in my host file (Windows\system32\drivers\etc\host), I must have made a change that the server didn't like - not true. I fired up the copied server, after shutting down the first, and all folders open without the 403 error.

 

Went over to the Apache error log file, and there are all of the FollowSymLinks messages - thing is, I can't even access "localhost" on this server anymore. Only folders that have the .htaccess files in them - I broke something in the process, and have been tearing out my hair trying to go backwards and figure this one out.

 

Have you ever seen this happen?

Share this post


Link to post
Share on other sites

Entries in the log file suggest you may need to add the following line:

 

Options +FollowSymLinks

 

In each root folder’s httacces file alternatively add it to each virtual host.

All the best

Ric :)

Share this post


Link to post
Share on other sites

add the following line: Options +FollowSymLinks

 

In each root folder’s httacces file alternatively add it to each virtual host.

 

That's the weird part - I disabled virtual hosts in the config file, and there are no .htaccess files in some of the folders, as some are only plain html or php files. (no scripting or complex things going on) :)

 

Should there be .htaccess files in all folders? (reason I ask is, my copied server which is working does not have .htaccess files in them, and the pages render happily)

 

Next, can you show an example of what you mean by "add it to each virtual host" - I'm not understanding if this is something I do in the config file or in a .htaccess file in each folder.

 

Bottom line, I can't seem to figure out why 2 nearly identical servers are behaving so differently - I must have altered something along the way!

Share this post


Link to post
Share on other sites

I was thinking in terms of something like this:

 

Options +FollowSymLinks

DocumentRoot /www/

ServerName localhost

 

You say the two are similar you can easily compare each file side-by-side using WinMerge-Portable obtain a copy from Portable Apps:

 

http://portableapps.com/apps/utilities/winmerge_portable

 

It will quickly highlight any differences you may have changed something accidentally that is difficult to find.

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Ric - thanks - that tool is a great help!

 

I figured it out. Here's what happened:

 

1. set up virtual host (test2) for a test folder that WordPress was loaded on - all good

2. went to GoDaddy and created the subdomain and appropriate A(host) record to point the subdomain to my server/IP address - all good

3. went into the local wordpress "options" page to set up the proper "Blog address URL" and "WordPress address URL" - this is what creates the appropriate rewrites in the .htaccess files - [if you don't do that, all of your links will be broken, for example - since WP was originally installed on "localhost/test2", all navigation within WP would try to get you to http://localhost/test2/page1/etc - obviously this would not work outside of the network]

4. all was working fine from the Internet, but when trying to go to some other local folders and localhost - got 403 Forbidden errors. - the cause - WordPress had written into the root .htaccess file a WordPress URL rewrite to deny any traffic not going to WordPress - which essentially locked out all other folders.

 

So, I went into the root .htaccess file, cleared the rewrite - and all is back to normal.

 

:)

Share this post


Link to post
Share on other sites

Note: I deleted your other post that links back to this just keeps everything in one place.

 

Thanks for taking the time to post your solution certainly will help others with a similar problem most appreciated.

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...