9

Recent Discovery

With IIS set back to port 80, when I put in http://localhost/ on the WHS computer, it gives me the "There is a problem with this website's security certificate" warning page. If I "Continue" anyway, this url comes up https://localhost/Remote/logon?ReturnUrl=%2fremote for a Windows Home Server 2011 Remote Web Access for a username and password. Now, I cannot recall for sure, but I do not believe that originally just a http://localhost/ brought up this issue. However, it seems as though this might affect any attempts to access localhost (no matter the port).

What may actually be the main issue

Oh the intricacies of networking! One thing that kept bothering me was why two of the sites would "partially" come up, and the others not at all. Then, running Firebug's NET tracking revealed to me that my main issue is that my ISP is acting as DNS proxy, and of course it is not finding my test sites. But it does find the two sites that are live at the www. (not test.) address, and appears to serve up those, but the images are blocked because (I assume) I have set up blocks to accessing the image files if not from the www. for the particular site.

That explains the mystery of the images not showing (expect on direct localhost:8080 call) and the odd behavior in "partially" finding those specific two of the five sites.

Now I need to figure out how to correctly configure either my router or a proxy file to redirect to back to my WHS computer. I am on Wildblue satellite internet service, as I am outside the area of any faster service connections. They have an "optimizer" file (I don't know if it is viewable to everyone or not, if not, it is basically the same as this version), that I may be able to modify and put on my local system to achieve what I need, but I am uncertain exactly what I may need to do there.

If anyone has any suggestions on either modifying that file, or how to configure my Linksys E1200 router to avoid sending to the proxy if it is a local site, then that may be the first (and possibly last) step to me solving my issues.

Representative code based on harrymc's recommendations... still not working

IIS port set to :90.

httdp file:

Listen *:80
ServerName localhost:80

vhosts file:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName localhost
    ProxyRequests off
    ProxyPass / http://127.0.0.1:90/
    ProxyPassReverse / http://127.0.0.1:90/
</virtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Users/Public/LocalWebsites/site1.net/httpdocs"
    ServerName test.site1.net
    ProxyRequests off
    ProxyPass / http://127.0.0.1/
    ProxyPassReverse / http://127.0.0.1/
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Users/Public/LocalWebsites/site2.net/httpdocs"
    ServerName test.site2.net
    ProxyRequests off
    ProxyPass / http://127.0.0.1/
    ProxyPassReverse / http://127.0.0.1/
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Users/Public/LocalWebsites/site3.com/httpdocs"
    ServerName test.site3.com
    ProxyRequests off
    ProxyPass / http://127.0.0.1/
    ProxyPassReverse / http://127.0.0.1/
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Users/Public/LocalWebsites/site4.com/httpdocs"
    ServerName test.site4.com
    ProxyRequests off
    ProxyPass / http://127.0.0.1/
    ProxyPassReverse / http://127.0.0.1/
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Users/Public/LocalWebsites/site5.com/httpdocs"
    ServerName test.site5.com
    ProxyRequests off
    ProxyPass / http://127.0.0.1/
    ProxyPassReverse / http://127.0.0.1/
</VirtualHost>

Previous Update: What I had believed to be the main issue (may be a sub issue)

How do I make Windows Home Server (running IIS) forward specific localhost URL's to port 8080 so that Apache (not IIS) running on the same machine picks the request up to serve the page?

The c:\Windows\System32\drivers\etc\hosts file has been changed (see below), but I assume that has nothing to do with rerouting to a new port. IIS, I also assume, is picking up the particular test.whatever url request on port 80 and routing to its own local host on the same port.

I downloaded Application Request Routing from a tip on a site I found in researching, but in looking at it, I'm not sure whether it will help or not (my hope was to set up some url based forwarding to port 8080 by it). I am a web designer, not a network wizard. So how all this works is somewhat elusive to me.

A Possible Direction to Go

Based off this link (found after searching more based off erikxiv's first comment below) I attempted the following in IIS as a URL rewrite:

Outbound Rule:

Match: .* (seemed to test okay)

Conditions:

Match Any of... (these seemed to test pattern match okay)

{HTTP_HOST} Matches the Pattern test\.site1\.net
{HTTP_HOST} Matches the Pattern test\.site2\.net
{HTTP_HOST} Matches the Pattern test\.site3\.com

Rewrite Action:

http://localhost:8080/{R:0} (it would not let me put R:1 like the example)

But there appears to still be no forwarding!


The information below is now all background behind the new, above, request.


Background Info

I recently changed an old desktop that was running Windows XP to be a Windows Home Server (2011). The old computer was also the host for local test sites running on an Apache install. Doing some research unveiled that running Apache on a WHS machine would not be as difficult as I first thought (many sites say that the IIS of WHS and Apache would cause issues, but a few I found mentioned no problems at all if set up correctly--basically, make sure there is no port conflict).

So I installed a WAMP (64-bit version) to the WHS computer, and changed the settings in the Apache httpd config file to listen at port 8080 so there would be no conflict with IIS. I set up my virtual host file as on the XP computer, only with the port change as well.

Basically, everything seemed to be running fine (however, see update), except...

The (Original) Issue

While the pages to the local sites pull up fine, and all css and javascript are functioning, every image file is not showing. The path info is correct as evidenced by right clicking and selecting View Image Info (in Firefox... by the way, the images do not show in any browser, so it is not a browser bug).

What I have noticed, however, is that the Type in the image info box is showing text/html, rather than PNG Image or JPEG Image etc. This is in the information below where it shows the path (address) info--in that section, it recognizes that the file itself is of Type either Image or Background.

But despite that fact, it appears that rather than recognizing the correct mime-type (I assume) of the image within the html (actually php generated html), it is instead trying to process the image (whether an img element or a css background-image) as text, and thus giving me nothing! But I cannot figure out why. The mime file controlling the Apache mime-types is correct. The pages have the following headers...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />

...but those should not be causing the issue (they did not when running on XP, nor do they on the live site).

So I am seeking thoughts on:

  1. Is my analysis of mime-type being the issue correct (based on update, probably not)?
  2. Where else can I look that might be causing the issue, and how to correct it? Could it still be a conflict with IIS on the WHS, and if so, what? Could it be anything in the php (this seems unlikely), and if so, what? What else can I check in Apache?

Updated Info (with more [related?] Issues)

Doing some more messing around, I've come to the conclusion that at least part of the issue seems to be the change to port :8080. First, I came to realize not all was as well as I thought in getting to all my sites. I have this representation in my c:\Windows\System32\drivers\etc\hosts file:

127.0.0.1   localhost
127.0.0.1   test.site1.net
127.0.0.1   test.site2.net
127.0.0.1   test.site3.com
127.0.0.1   test.site4.com
127.0.0.1   test.site5.com

And this representation in my apache vhosts file:

NameVirtualHost *:8080

<VirtualHost *:8080>
    DocumentRoot "C:/Users/Public/Documents/LocalWebsites/site1.net/httpdocs"
    ServerName test.site1.net
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "C:/Users/Public/Documents/LocalWebsites/site2.net/httpdocs"
    ServerName test.site2.net
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "C:/Users/Public/Documents/LocalWebsites/site3.com/httpdocs"
    ServerName test.site3.com
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "C:/Users/Public/Documents/LocalWebsites/site4.com/httpdocs"
    ServerName test.site4.com
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "C:/Users/Public/Documents/LocalWebsites/site5.com/httpdocs"
    ServerName test.site5.com
</VirtualHost>

Here's the behavior: site1 and site4 are showing up, but without images. The other three do not show up at all, but give Network Error (dns_unresolved_hostname).

However, if I access the first site in the vhosts on the WHS machine by using localhost:8080 in the url, then the images do show up, and whichever site is first in my vhosts file also shows up (which is expected); however, it does so even if it was one that previously would not (so if I move site2 to the first position, it starts "working" via localhost:8080 call).

I know my image files are returning a 403 (corrected, originally I said 404) error when accessed via test.site4.com syntax in the url, and I suspect that my images are showing up as text/html because the files are returning that error (so I don't think it is a mime-type issue now as much a failure to find the images). But the odd thing is that the paths are correct, and non-image files (javascript and css) are coming up fine.

So in my mind it seems like it maybe something with the port switch to 8080. My issues now are:

  1. Why are my hosts and vhosts files not correctly finding all the sites (is there some other file I need to modify on a Windows Home Server)?
  2. On those sites it does work for, why do the images specifically not get found (with the 403 error, that is "forbidden" I believe, which makes no sense if the other files in the website folders are being allowed access)?
  3. Why does the localhost:8080 access work no matter what in relation to the first two issues?

Some Further Info

A request was made for me to post log files. However, I discovered there were no logs occurring except (it appears) in those instances when I had accessed via the direct localhost:8080 call to the "default" site.

So I turned off the WAMP services, and went to the url's and discovered the same behavior as when WAMP was running. This would seem to indicate that IIS is still controlling the domain names, rather than Apache picking them up (can someone confirm my assumption there?), and thus the issue may well be something still with getting control itself over to the WAMP server.

6
  • Make sure the permissions on the actual images are set so that they can be accessed.. just a guess.
    – cutrightjm
    Apr 19, 2012 at 1:27
  • @ekaj--I appreciate the guess, and checked permissions, but that is apparently not the issue.
    – ScottS
    Apr 19, 2012 at 2:20
  • @ekaj--I added some updated info to my issue that may help you in coming up with a different "guess" (maybe a solution!).
    – ScottS
    Apr 19, 2012 at 10:52
  • Are you sure that Application Request Routing does not work? blogs.iis.net/wonyoo/archive/2008/07/09/… seems to do what you are asking. Note that you might want to write several rules to match your different sites.
    – erikxiv
    Apr 21, 2012 at 18:08
  • @erikxiv--no, I am not sure about it. My problem was the fact that I'm in territory unfamiliar to me, so I did not know how to make it work if it could. I'll look into the link and get back to you.
    – ScottS
    Apr 21, 2012 at 23:59

5 Answers 5

1

Do you perhaps have a .htaccess file that is causing images to be served as text/html?

 <filesMatch "\.(htm|html|css|js|png|jpg)$">
 ForceType 'text/html; charset=UTF-8'
 </filesMatch>
2
  • Good suggestion, but only a couple of the sites have .htaccess files, and none have a ForceType in the code.
    – ScottS
    Apr 19, 2012 at 2:18
  • @ScottWilson--I added some updated info to my issue that may help you in coming up with a different solution.
    – ScottS
    Apr 19, 2012 at 10:51
0

If you can provide your access.log files (at least a couple of lines showing the 404 status for the image requests), we would be able to check what goes wrong. I suspect that it simply might be a domain name issue, or your site may use absolute paths for images (just guessing...) which apache handles incorrectly

4
  • Interesting. There are no log files for my attempted accesses, except in those cases where I was using the direct localhost access. So I turned off the WAMP server all together, and found I was getting the same results. Which would seem to indicate Apache is not handling the requests to begin with, but IIS is.
    – ScottS
    Apr 20, 2012 at 10:55
  • By the way, I mistyped previously, the images are giving a 403.
    – ScottS
    Apr 20, 2012 at 11:06
  • Maybe it's better to wireshark the browser requests and check if it really asks for that? Or check the apache err log if it failed to bind to the port or gives some address issues... Apr 22, 2012 at 10:53
  • @MartinoDino--Thanks for your suggestions. I've just updated some info in my question that I believe now my main issue to be that my WHS computer is not even handling the request for my test sites, but rather my ISP proxy seems to be. If I can get that resolved, then I'll begin to find out if my other local parts are actually working.
    – ScottS
    Apr 23, 2012 at 1:10
0

The thread IIS redirect to Apache contains a very simple solution, which goes in the opposite direction to yours.

The writer of the last entry says that redirects in IIS are too limited to do the job.

Using his solution, you would set up IIS to receive requests from another port than 80, for example 90. Then put Apache as the receiver for both ports 80 and 8080, with a redirect of port 80 to port 90. Apache apparently manages to do what IIS cannot.

10
  • @harrymc--thanks for the input. That may be useful, however, if you look at my latest update (just posted), I've discovered that my first main issue is that the test url's are never making it to my local computer, but are attempting to be handled by my ISP proxy. If you have some suggestions about circumventing that, I'm open.
    – ScottS
    Apr 23, 2012 at 1:07
  • That might still be in line with my suggestion : IIS might not be smart enough to detect that localhost is a local loop-back interface, so searches for it instead on the Internet. Of course localhost will never be found there. I don't have the right environment for testing this, but the above article seems to say that Apache does the job more intelligently.
    – harrymc
    Apr 23, 2012 at 9:32
  • @harrymc--As I mentioned in my question, I'm not really a network person, so I have a couple of questions and need a little guidance. First, is changing my WHS to port 90 going to affect how the WHS functions as a home server? Second, the link you posted refers to trying to access subdomains, whereas I am not (rather, I'm seeking to access different local domains); so does that change anything? For guidance from the linked solution, I have some Apache knowledge, so #4-5 I follow, but I have nearly zilch IIS knowledge, so points #1-3 I'm unsure how to do (or even in my case if I need to do).
    – ScottS
    Apr 23, 2012 at 14:28
  • #2-3 probably do not apply to your case and can be skipped. #1 is required, as that is the main idea. The trick here is to make Apache the main Internet front server in charge of forwards, and IIS into a secondary and local one that is not connected to the Internet except thru Apache. Maybe this article could help for the port change. If you have never done this before, keep carefully note of everything you change, just in case.
    – harrymc
    Apr 23, 2012 at 14:50
  • @harrymc--Having made the changes, I cannot even get my WAMP server to start. Not sure why, but at present it prevents a full testing to know if it is going to work. I am also wondering if, in the first link, the ourdomain.dom is something specific to my computer or not (or is it just an arbitrary name, since he was dealing with subdomains... should mine be localhost?). Additionally, in the first link, the our.ip.addess for the routing to IIS is going to be the same for the Apache server, as they are on the same computer (just different port). That should not cause issues, right?
    – ScottS
    Apr 23, 2012 at 23:58
0

Since you've tracked it down to a DNS issue the basic result is that you need a local DNS server that you can configure. You also mention a Linksys E1200 router and Windows Home Server, so there are two approaches you can take.

First, you can consider running a third-party firmware (e.g. DD-WRT, OpenWRT, Tomato) on your router. The one you have is using a Broadcom chipset and should have adequate flash; DD-WRT lists it as supported. My biggest concern is that somehow the third-party router firmware community appears to have devolved down to the point where it's like trying to run Linux back in the early '90s. You can try to dig through the forums to find what you need, but don't trust the router database on the DD-WRT site because it'll direct you to the wrong things. Overall this option fails to fill me with confidence, and unless you have a second router available I'm not sure I can recommend it unless you like tweaking this kind of thing.

Second, you can RDP into the WHS and turn on the DNS server as described in this forum thread. Basic approach, RDP in, Control Panel, Add/Remove Programs, Add/Remove Windows Components (button), select DNS Server checkbox, get back out. What I'm not sure about is whether you get the DNS management console with this, and I don't have a WHS box to test it on. If you DO get that console, it'll be under Administrative Tools / DNS. To use it as you're going to want it, you'll need to add new forwarding zones; for the kind of thing you're doing I'd add a zone for each host (e.g. add a zone for www.samplesite.whatever) then add an A record entry to it with no name specified which will make it the default for that zone. The other approach would be to add a zone for samplesite.whatever, then add named A records (e.g. "www" or "mail"), but that may end up blocking things you don't want blocked. The more targeted zone keeps you from affecting things you don't want redirected. You'll then point all of your systems at this box as the DNS server. By default this will do its own external DNS resolution completely bypassing your ISP's DNS servers; if you want to use those as the next stage you can specify their addresses as Forwarders in the DNS server properties (right-click and hunt around).

Third, if option Two doesn't work and option One frightens you, you can set up a Linux box internally and set it up as a DNS server. There's plenty of instruction out there for how to do so; a cursory search turned up this article by Mark Kolich that appears to be decent instructions to do exactly that. If you're so inclined, this may also offer you the resources you need to experiment with Linux-based hosting (unless you're doing Windows-based development e.g. .NET or the like).

This Wikipedia Comparison of DNS Servers may also be of use. Of possible note are Simple DNS Plus (commercial), Posadis (free, stale? 2004), MaraDNS (free, non-GUI, worth looking at), and Unbound (free, does have Windows binary downloads, didn't dig further). All of these should run on Windows.

6
  • Thank you for your answer. While it is true that it is a DNS issue in some sense, what I want is for any localhost call to not even go to the DNS of my ISP to begin with (it shouldn't). It seems "overkill" somehow to have to set up a DNS locally to handle what should be handled already, automatically by the system. My requests for localhost sites should not even be going to my ISP DNS.
    – ScottS
    Apr 24, 2012 at 14:56
  • If you add the relevant lines to the local Hosts file, they might not - on XP it was in c:\windows\system32\drivers\etc\hosts, not sure where it is on Vista/7 and whether it varies between 32- and 64-bit. I have seen some apps or error situations where that can break, as noted here: fencepost.net/2009/11/dns-fails-nslookup-works-fix
    – fencepost
    Apr 25, 2012 at 2:11
  • I have already added those lines to that location (from the start), but I have wondered if it is the correct location on a 64-bit system (which WHS is).
    – ScottS
    Apr 25, 2012 at 11:03
  • Your question led me to do a bit more digging and this (sepago.de/helge/2009/06/04/… ) appears to be very relevant.
    – fencepost
    Apr 25, 2012 at 17:55
  • That was interesting, but I'm not sure how helpful, as the C:\Windows\System32\drivers\etc file was already the one I modified, yet it still does not seem to be getting picked up as far as defining my local sites. The article seems to indicate that the file is used by 64-bit natively, and 32-bit by redirection. How might this affect my Apache install and why localhost is ignored for my local sites?
    – ScottS
    Apr 25, 2012 at 19:09
0

you need to have

<directory>
</directory>

before </VirtualHost> to allow.

something like this

<Directory "C:\Apache24\htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

i use 192.168.1.100:80 for iis and 192.168.1.200:8080 for apache in the Internet Protocol v4 IPv4 Settings (Advanced IP Settings) have 2 class C ip 192.168.1.100 and add 192.168.1.200 this also helps in SEO because of class C ip addresses for 2 different websites linking to each other.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .