Take the 2-minute tour ×

I want to start an Apache 2 server on localhost:8080 on an as-needed basis without superuser permissions, with the root directory for web content being /home/user/example/web/directory. I don't want the server running all the time; only when I am testing it (when I stand it up it will be running on a different box). What is the best way (i.e. least configuration needed without loosing security) to do this?

share|improve this question
add comment

1 Answer

  1. Write a configuration file. Make sure you point the document root to the appropriate directory. Don't forget to change the port, possibly IP addy. Remove the user and group directives. Normal stuff.
  2. Run httpd -f /path/to/your/config/httpd.conf
  3. ...
  4. Profit!

Also, use the -X argument if you don't want it to detach from the console.

share|improve this answer
+1, but could you provide a little more detail? It's rather overwhelming to try to figure out what the "normal stuff" is when you're new to Apache. –  Kazark Nov 25 '11 at 23:25
"Normal stuff" would be the stuff not related to running Apache as a non-root user. –  Chris S Nov 26 '11 at 0:32
add comment

Your Answer


