0

I’ve been having trouble wrapping my head around what I need to do here at work so this will be my attempt to do so.

I have a server for my own usage where I have a WAMP server running, and I’ve figured out how to get it online and navigate to it. The goal is to make it Intranet only and I’ve found that as well I believe (first 3 parts of the IP in the required section in httpd.conf file) and tested that. With that in mind I have 2 projects that I would like to host on there using the same IP address and then have them accessible by the host name from people within the company.

So if I name them projectA and projectB I have the two virtual hosts with servername projectA and projectB included in the httpd.conf file on the server. Also because of something we run at work I have it listening to port 8080 instead of port 80.

For short term testing I have my laptop with an entry in the hosts file mapping the IP address to the host name I’m going for, let’s call it hostC.

What I would like to be able to do is access projectA and projectB on hostC as a reasonable process by typing something like //hostC/projectA/projectA/fileA.php into the search bar, but what I’ve seen shows server names as only something like www.projectA.com which would then take it out from the host banner. So can I do what I want or am I thinking of it in the entirely wrong way?

My thoughts if what I’m doing is wrong are that either I would need to have two hosts mapped in my host file (will be represented in the company’s DNS server) and have it be more like //hostA/projectAindex.php and //hostB/projectBindex.php or just keep it as one host and provide a page which forks off to the two different projects like //hostA/projectAindex.php and //hostA/projectBindex.php. Does one of those make more sense?

I’ve read a lot about it, and gone through the Apache documentation I’m just not entirely sure what it means or how to think about it.

2
  • 1
    The whole point of name-based virtual hosts is so you can access different sites on the same server according to their hostname. If you don't want to access the server by the hostname (e.g. projectA) then there's no point in name-based virtual hosting. If all you want is hostC/projectA then what you need is folders, not virtual hosts.
    – qasdfdsaq
    Commented Oct 28, 2015 at 19:38
  • It might be. We have two locations with different subnets, and I need to get it accessible only from them. I put my WAMP online, and limited it to my particular location's subnet, so I believe that just adding the second one to the apache CONF file will get me what I want with it being on the intranet. If I'm completely off let me know, and thanks for the input already.
    – bmac
    Commented Nov 6, 2015 at 19:43

1 Answer 1

0

If you want to access HostC as a hostname (e.g. hostc.local) from anything other than a computer with a modified hosts file, you will have to set up a DNS server to map this name to your web server's IP address.

If HostC can be the IP address of the server, then you can just use that.

Assuming either case, you can put sub-folders (ProjectA and ProjectB) in HostC (your web server) to access http://HostC/ProjectA/fileA.php and http://HostC/ProjectB/index.php. You do not need virtual hosts for this.

If you want http://HostA/ProjectA/fileA.php and http://HostB/ProjectB/index.php, then you will need to define HostA and HostB in DNS (to access them from any computer without a modified hosts file, assuming you do not wish to access them via IP address/port combinations). You will need use virtual host entries assuming HostA and HostB both map to the web server on HostC. You will only need to map HostC in this case if you want to access HostC as a local domain name, not an IP address.

You may want virtual hosts as well to access services via reverse proxyies to map, say, something like http://HostD:80/directoryD/ to HostD:8080/directoryF/ or ex. 123.123.123.123.

0

You must log in to answer this question.

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