Start an apache server in any directory from command line Start an apache server in any directory from command line apache apache

Start an apache server in any directory from command line


What about apache debug mode (-X) ?

apache2 -X -d. -f.htaccess -C"PidFile `mktemp`"  -C"Listen 1025" -C"ErrorLog /dev/stdout" -C"DocumentRoot `pwd`"

to put it in the background once started you may use Ctrl^Z then type "bg"

Using the the FOREGROUND flag, wrapping it up in a shell script:

#!/bin/shif [ $# -ne 2 ]; then     echo "$0 <port> <dir>"    exit 10 fi/usr/sbin/apache2 -DFOREGROUND -d. -f.htaccess -C"PidFile `mktemp`" \ -C"Listen $1" -C"ErrorLog /dev/stdout" -C"DocumentRoot $2" -e debug

call it "pache", chmod +x, then you can run

./pache 1026 /tmp/webroot


http-server is a much better simple http server than pache, it's what I use currently! :)

Use [pache][1]

Install with npm - which comes with node here: http://nodejs.org/

sudo npm install pache -g

Run on current dir, port 3000:

pache

Or specify directory and port:

pache site-directory 2000

[1]: https://github.com/devinrhode2/pache


This works:

Your apache config could point to /var/www

Then use:

sudo mount -o bind /home/webcreatorperson/mywebsite /var/www

to unbind use:

sudo umount /var/www

If you want several ports you could preconfigure ports in apache to point to directories like /var/www/8000.