I want to be able to start an apache server from the command line, typing something like apache site-folder
or apache . --port=2000
This sh
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/sh
if [ $# -ne 2 ]; then
echo "$0 "
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