Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a noob question.

I installed Apache (apache2) in my Ubuntu host. Now I would like to configure it to do the following:

  • map http://localhost/my-app to ~/dev/my-app
  • map http://localhost/api-1 to http://apisrv/api-1
  • map http://localhost/api-2 to http://apisrv/api-2

As I understand, I should configure Directory and Proxy. My questions are:

  • Which configuration file exactly should I edit to add the Directory and Proxy definitions ? /etc/apache2/httpd.conf, /etc/apache2/apache2.conf, or /etc/apache2/sites-enabled/000-default

  • How to configure Directory and Proxy for the mappings above?

share|improve this question

migrated from May 4 '12 at 13:29

This question came from our site for professional and enthusiast programmers.

Look into the httpd file.
If you look closely, you'll see 1 Directory worked out, with a lot of comments. Just copy paste it for every directory and adjust it where needed (remove the comments for more overview)

share|improve this answer

For newer Apache installs you want to put your custom directives in Sites.Enabled. Your General Apache configuration is in http.conf. Sites.enabled directives override httpd.conf on startup. Also, I don't see a reason to have a proxy based on what you have described above.

share|improve this answer
Ok, So would you suggest map http://localhost/api-1 to http://apisrv/api-1 ? – Misha May 2 '12 at 16:57
Yes, you can alias directories to localhost all day based on your needs. If you describe what you want to accomplish I might be able to give you some examples. From what I am reading above I don't quite understand what you are looking to do. Basically all you're doing is pointing a localhost web url to a directory on the filesystem. In your case it looks like you want a couple VirtualHosts off Localhost for you to map your three directories. Try to elaborate more on your needs. Apache is ridiculously configurable for just about anything these days, you just need to know what you want. – apesa May 2 '12 at 17:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.