Setup new web project


/ Published in: Bash
Save to your folder(s)

A small script that sets up a new VirtualHost with Apache and adds an entry for the site to your hosts file.
You need to adjust the paths to your needs.
Must be run as root.


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. if [ $# -ne 1 ]
  4. then
  5. echo "Usage - $0 project name"
  6. echo ""
  7. exit 1
  8. fi
  9.  
  10. echo "
  11. 127.0.0.1 $1" >> /etc/hosts
  12. echo "
  13. <VirtualHost *:80>
  14. ServerAdmin me@localhost
  15. DocumentRoot /home/stefan/wwwroot/cake/$1/webroot/
  16. ServerName $1
  17. </VirtualHost>
  18.  
  19. " >> /etc/apache2/sites-enabled/all
  20.  
  21. apache2ctl restart

URL: init-site

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.