Posted By

octaviannitagmailcom on 06/14/13


Tagged

config virtual host


Versions (?)

Apache Virtual Host


 / Published in: Apache
 

Configure Apache virtual hosts and PHP usage... (also see http://stackoverflow.com/questions/9110179/adding-virtualhost-fails-access-forbidden-error-403-xampp-windows-7 and http://foundationphp.com/tutorials/apache22_vhosts.php)

  1. ## In C:\WINDOWS\system32\drivers\etc\hosts or /etc/hosts
  2. 127.0.0.1 localhost
  3. 127.0.0.1 cs2
  4.  
  5. ## In httpd.conf or apache2.conf
  6. #Virtual hosts
  7. Include conf/extra/httpd-vhosts.conf
  8.  
  9. LoadModule php5_module "c:/Program Files/PHP/php5apache2_4.dll"
  10. AddHandler application/x-httpd-php .php
  11. <IfModule dir_module>
  12. DirectoryIndex index.php index.html index.htm index.xhtml
  13. </IfModule>
  14.  
  15. ## In httpd-vhosts.conf
  16. NameVirtualHost *.80
  17. Listen 80
  18.  
  19. <VirtualHost *:80>
  20. ServerName localhost
  21. #ServerAlias www.localhost.com
  22. ServerAdmin [email protected]
  23.  
  24. DocumentRoot "C:/Apache24/htdocs"
  25. <Directory "C:/Apache24/htdocs">
  26. Options +Indexes +FollowSymLinks -MultiViews
  27. AllowOverride All
  28.  
  29. Require all granted
  30. # Replaces in 2.4:
  31. #Order allow,deny
  32. #Allow from all
  33. </Directory>
  34.  
  35. ErrorLog "logs/localhost-error.log"
  36. LogLevel warn
  37.  
  38. CustomLog "logs/localhost-access.log" combined
  39. </VirtualHost>
  40.  
  41. <VirtualHost *:80>
  42. ServerName cs2
  43. #ServerAlias www.cs2.com
  44. ServerAdmin [email protected]
  45.  
  46. DocumentRoot "D:/Workspace/cadeauxsucres2"
  47. <Directory "D:/Workspace/cadeauxsucres2">
  48. Options +Indexes +FollowSymLinks -MultiViews
  49. AllowOverride All
  50.  
  51. Require all granted
  52. # Replaces in 2.4:
  53. #Order allow,deny
  54. #Allow from all
  55. </Directory>
  56.  
  57. ErrorLog "logs/cs2-error.log"
  58. LogLevel warn
  59.  
  60. CustomLog "logs/cs2-access.log" combined
  61. </VirtualHost>

Report this snippet  

You need to login to post a comment.