0

TLDR: Would a "real server" (Apache? Flask? Django?) be able to unify various services behind readable subdirectories (abc.work.com/svn, abc.work.com/hg) instead of using port numbers (abc.work.com:8000, abs.work.com:8001)?

Long Version: In the last year I've learned how to serve files with Mongoose, run a minimal python webserver, host version control repositories with Subversion and Mercurial, and host a Trac issue tracker/project management framework.

In each case I've been using the easy built-in webserver provided by each tool to host it from my Windows 7 laptop at work (I'm an engineer who codes, not actually paid to be a "software guy"). In order to avoid clashing I've used different port numbers in the 8000 range for each server to listen on, and sent my coworkers links like http://machinename.domain.com:8042 to access these magical things I've created.

The first obvious problem is that I'm running a lot of these things out of a command prompt and just letting it sit open on my desktop. I also know how to call cmd.exe from VBScript in order to hide the command prompt if that's all I wanted. Many of the built-in webservers even have options to run as a service, which can get harry with permissions, but is closer to the "right" way to host a server of any kind.

The bigger problem is that I'm sending people links to my machine with different port numbers. I'm ok with them having to use my machine name - I assume I'd need the network admin folks to add a DNS entry to call it TeamAwesome.company.com instead of machinename.company.com:8000?

The bigger question is, if I did something fancy like an Apache, Django, or Flask webserver, could I set it up like machinename.company.com/trac for the trac server and machinename.company.com/hg/project1 for the HG repository for project1? I'm looking at Apache, Django, and Flask because I've been diving into Python for 2 years now and those appear the most applicable/approachable for my needs.

I understand that ideally this stuff should be hosted on a separate linux-y server machine, but I'll need to prove the usefulness of the tools I'm developing before I request server resources from my boss (who hired me to do engineering, not programming, or web development, or systems administration, etc.).

I see this looks related. Are http proxies, virtual hosts, nginx, and WebSockets things to look at?

Looking at Apache VirtualHost examples looks promising though I can't decipher if one of those examples actually does what I'm talking about. Thanks for any suggestions as I go further down the rabbit hole with this stuff!

davidism
  • 121,510
  • 29
  • 395
  • 339
flutefreak7
  • 2,321
  • 5
  • 29
  • 39

2 Answers2

0

Apache virtual hosts can be differentiated by listening ip and/or port number only. The mod_proxy module can do what you want if you want/have those services to be running separately as well:

 ProxyRequests Off
 <Proxy *>
     Allow from all
 </Proxy>

 ProxyPass      /folder_a       http://backend_a:1234/ retry=5
 ProxyPass      /folder_b       http://backend_b:8888/ retry=5
 # etc

However if you just want to point different urls to point to unrelated folders on your server then check the Location and Alias directives

fejese
  • 4,601
  • 4
  • 29
  • 36
0

No need for proxy settings. You can use a single virtual server, but run each application under a certain subdirectory: for example, with Django or another wsgi app, you would simply set WSGIScriptAlias to the relevant dir.

A big clarification, though: Django is not in any way a server. In fact, you need Apache or an equivalent in order to serve Django properly.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • I think I understand what you mean if my wsgi app were a python module or something that can be called when a given subdirectory is queried, but what if my app is another server running on some port? Can all server-y services like repositories, webservers, etc. exist as wsgi apps? Even if I can tie some services directly into the webserver I'd still like to be able to provide folder-like access to things being served separately on a local port, because that sounds useful. Or am I missing the point? – flutefreak7 Feb 19 '14 at 21:12