Set up a local virtual host website


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



Copy this code and paste it in your HTML
  1. // edit httpd.conf or some included apache configuration file...
  2.  
  3. <VirtualHost *:80>
  4. ServerName local.mysite.com
  5. DocumentRoot /usr/local/Sites/local.mysite.com/public_html
  6. ErrorLog /usr/local/Sites/local.mysite.com/logs/error_log
  7. CustomLog /usr/local/Sites/local.mysite.com/logs/access_log combined
  8. ScriptAlias /cgi-bin/ "/usr/local/Sites/local.mysite.com/public_html/cgi-bin/"
  9. </VirtualHost>
  10. <Directory /usr/local/Sites/local.mysite.com/public_html>
  11. AllowOverride all
  12. Options MultiViews Indexes FollowSymLinks Includes +ExecCGI
  13. Order allow,deny
  14. Allow from all
  15. </Directory>
  16.  
  17. // then...
  18.  
  19. $ sudo sh -c 'echo "127.0.0.1 local.mysite.com" >> /etc/hosts'
  20. $ lookupd -flushcache
  21. $ sudo apachectl configtest
  22. $ sudo apachectl restart
  23.  
  24. // to give apache access to a folder in your home dir...
  25.  
  26. $ sudo gpasswd -a apache yourgroup
  27.  
  28. // otherwise make sure that the directory containing your HTML files and each of its parent directories has chmod o+x set on it

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.