Server Alias in IIS - apache

I would like to create the equivalent of Apache Server Alias entries in IIS 7.5. Anyone know how to do this?

If I understand Apache's Server Aliases correctly, then what you're looking for is a Virtual Directory. In IIS manager, right-click a website or folder and select "Add Virtual Directory." You can then add a directory to the website with a specific alias (which will form part of the Url) and physical path (which can be anywhere on disk, not necessarily under the root folder of the website).
EDIT: suspecting that I've confused Apache's "alias" and "server alias" functions: you may be looking for an IIS site's "Bindings", which allow multiple domain names to be mapped to specific web applications.

Related

Can I direct a cpanel folder to a domain name hosted with a different registrar?

I'm wondering if this is possible and I'm not sure that it is. Before I explain, I found one other post [here]: Separate Domain Registrar and Host, possible to use CDN? which sounds similar to my problem, but I specifically don't want to point the Name Servers away. I only mention this because my question is going to sound very similar.
So I'm trying to help a friend who has a Domain Name registered on Site A (let's assume it's a place like Wix). He also has a hosting package on Site B (to have cpanel access for a site he had built with HTML & PHP).
for example:
1. www.yourdomain.com is hosted on Wix with a template website
2. "database" is a cpanel folder on Site B
Is there a way to have www.yourdomain.com/database link to the "database" folder on Site B's hosting -- without changing the Name Servers?
I don’t believe you can point a directory to a completely different server or hosting package.
However creating a sub domain instead could be your answer.
Is there anything stopping you from using database.yourdomain.com and creating an A record for this in your domain registrar and point it to the hosting package of database?

How to exclude subdomain directory from main website

I've setup a VPS with apache2.
I am using cloudflare for DNS management.
Now, I have my websites's files in "var/www/website" folder. Inside that, there is another folder for forum. like "var/www/website/forum" inside which there are all forum related files.
Now, suppose I have www.website.com pointing to "var/www/website"
and I also have a subdomain forum.website.com pointing to "var/www/website/forum".
What I want to do is make the files inside "var/www/website/forum" accessible via subdomain only. I don't want users to access forum via www.website.com/forum, but I want them to access it only via "forum.website.com"
What you need to do is set up what's called a virtual host. You would put your forum at /var/www/forum and website at /var/www/website.
inside /etc/apache2/sites-available, you'll need to add an additional configuration file for that site called forum.website.com.conf.
You'll then need to create a symbolic link to /etc/apache2/sites-enabled for that file so that apache sees it. From there, you reboot the server and are good to go.
Here's some documentation:
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/examples.html
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
This may be a bit different depending on the flavor of linux, but should be about the same. Control panels like Cpanel, Plesk and WebMan can make this process a bit easier by abstracting the configuration to a web control panel.
Hope this helps you.

Virtual Directory to navigate to http://localhost/MyWebsite instead of http://localhost:8080

I have deployed an ASP.NET MVC 4 application to a new site I have created in IIS 7.5, which I have bound to port 8080. I can reach it by navigating to http://localhost:8080, but I want to reach it via http://localhost/MyWebsite.
I have added a Virtual Directory under my website, which points to "C:\inetput\wwwroot\MyWebsite\". However, when I navigate to http://localhost/MyWebsite, I am presented with a configuration error:
"It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."
Here is what my IIS hierarchy looks like (this is a demo since I have no internet access on the server I am working on).
I have two questions:
Why am I getting this error?
Is this the best way to go about achieving what I want? It seems messy to have the list of files and folders underneath the website and then again underneath the Virtual Directory. If there is better practice then please tell!
Virtual Directories cannot execute scripts, reason why you are getting that error. You need to make your MyWebsite folder an Application. Also, you don't necessarily have to create a separate website for your website, you can use the Default Web Site and create an application MyWebsite in there (it might be less confusing maybe?).

IIS virtual directory home different than Apache

I have a site I developed on a WAMP server in house, and is hosted offsite (presumably on an Apache server). The site was created in the root directory of the WAMP server (C:\wamp\www). I'm now trying to move the in house development site onto a Windows Home Server v1 box (essentially a Server 2003 machine running IIS 6). I'm trying to not have two different versions of the site: one for in house (on IIS), and one for hosting offsite (on Apache).
On the WHS machine, I have a virtual directory <sitename> located at:
c:/inetpub/<sitename>
I can access it on the server at:
Localhost/<sitename>
and from anywhere on the LAN at:
<ServerName>/<sitename>
When I initially wrote the site, I used the ../ declaration for almost every file,
path, directory, and PHP include files. This works fine on the WAMP server and on the
offsite host. But, when I moved the site into the virtual directory <sitename>, it
fails on the IIS server.
All such ../ references point to the server root:
<ServerName>/
rather than site home:
<ServerName>/<sitename>
Presumably, I could move the site into the 'root' directory: c:/inetpub/wwwroot, but
Windows Home Server uses this for something else.
I could change every reference from ../ to ../<sitename>/, but that would mean having 2
different sites to maintain, one for in house and one for offsite.
So, my questions are ...
Is there any way to declare that the virtual directory c:/inetpub/<sitename>
is the home or root directory for this single site? Is there a configuration
in IIS that will do this for this one virtual directory, and not upset the other
sites hosted on this server?
If not;
Can someone point me to some other way to rewrite the site in order
to have it run on both Apache and IIS 6 with no/minimal
alterations for the two different servers?
I have been searching for over a week on this. All of the solutions that I have found are specific to either Apache or IIS, but won't work in both.
Thanks!
Ok, here's a -possible- answer ...
I changed every ../ to a PHP include statement, calling a file I named SiteBase.txt.
On the IIS server, SiteBase.txt consists of a single line: http://<ServerName>/<sitename>/.
On the WAMP server, SiteBase.txt consists of a single line: ../
This way, I only have to change this one file when I move the site from my development server to the production server. A bit Brute-Force, but it seems to be working.
Does anyone see a problem with this?
Thanks!

IIS 6 - Create a virtual directory that points to an IIS application on a different server?

Here's the scenario:
Server A is hosting the 'main' application (www.example.com)
Server B is hosting a support application (b.example.com)
They are connected internally to each other through a 192.* address and are both externally available through DNS
Server A has several virtual directories that are mapped through UNC shares:
www.example.com/virtual1 -> \192.168.1.1\virtual1 (on serverB)
I'd like to be able to run the application that sits on Server B (served through IIS) and make it appear as if it's running on serverA:
www.example.com/application -> b.example.com/app
I'd still want to be able to access server B directly
b.example.com/app
Any ideas?
Edit:
Turns out the application behind the proxy refused to let me dynamically change it's form "action" (nor did it let me change anything else). I was able to display the data from the server; just couldn't post :(
So both answers pointed me in the right direction. I used a proxy:
http://code.google.com/p/iisproxy/
I created a virtual directory on Server A that matched the directories I needed on Server B - and it worked! :-)
This should be possible in IIS. I remember I had to do this once.
Just create a virtual directory using the UNC path pointing to \\ServerB\SharedAppDirOnB and (if necessary) "Connect As..." using the credentials needed for Server B.
If you have problems with "Connect As..." it could be a folder permissions problem of Server B. Try the following thing: add a new user account on your main server which has the same name and password as the account on Server B. It sounds stupid, but I remember it solved my issue. You could for example add a new user account on both servers: "IisCommon" with the same passwords on both servers. Then make sure you give all necessary file access permission to the folder on server B (and the Share permission!). Try first connecting manually using Windows Explorer if you can access the share.
Make sure that you mark the new virtual directory as application and give the right execution permissions.
Another solution would be some kind of reverse proxy. I used a third-party product on IIS 6.0 for this: ISAPIrewrite for IIS. The "proxy" mode allows you to "forward" request made to your main server (www.example.com/...) to your other server, but serving the resulting responses as if they were processed by your main "domain" application. The feature is called "proxy directive". It accepts regular expressions.
Since serving the virtual directory from server A through a UNC share apparently does not work, you need to serve b.example.com/app from server b.
DNS resolves domain names to IP addresses. You are asking for the same domain name to resolve to two different IP addresses, based on a different URL. This is not something that IIS or Windows can do.
Your options are:
write a proxy service on server A that passes requests on to server B. If you want it completely transparent (not just a redirect), you'd have to stream back the response as well. This is not trivial, but possible.
Put the server B page into an IFRAME on a new page on server A.
Use a load balancer in front of both servers that can split traffic based on URL