Skip to content

Instantly share code, notes, and snippets.

@yuhsienlee
Created August 10, 2012 07:44
Show Gist options
  • Save yuhsienlee/3312401 to your computer and use it in GitHub Desktop.
Save yuhsienlee/3312401 to your computer and use it in GitHub Desktop.
sudo apachectl start
httpd -v #to show apache version
#/Library/WebServer/Documents/index.html.en #the system doc root
mkdir -p ~/Sites #to make user level sites default doc root
#Make user level site config
#sudo vim /etc/apache2/users/$USER.conf #
sitePath=~/$USER.conf
target=/etc/apache2/users/$USER.conf
rm -f $sitePath
echo '<Directory "/Users/'$USER'/Sites/">' >> $sitePath
echo 'Options Indexes MultiViews' >> $sitePath
echo 'AllowOverride All' >> $sitePath
echo 'Order allow,deny' >> $sitePath
echo 'Allow from all' >> $sitePath
echo '</Directory>' >> $sitePath
#finally make this file's permission be
sudo chmod 644 $sitePath
sudo mv -f $sitePath $target
sudo apachectl restart
#use http://localhost/~<your user name>/ to view your own web site
#open PHP
#set httpd.conf for use php .so
sudo sed -in '/^\#LoadModule\ php5_module/s/^.//g' /etc/apache2/httpd.conf
sudo apachectl restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment