Advertisement
Guest User

cPanel Apache wildcard subdomain virtual host

a guest
Mar 7th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. Non-SSL
  2.  
  3. <VirtualHost x.x.x.x:80>
  4. ServerName *.domain.com
  5. VirtualDocumentRoot /home/username/public_html/subdomains/%1/
  6. ServerAdmin webmaster@domain.com
  7. UseCanonicalName Off
  8. CustomLog /usr/local/apache/domlogs/domain.com combined
  9. CustomLog /usr/local/apache/domlogs/domain.com-bytes_log "%{%s}t%I .\n%{%s}t %O ."
  10. ## User username # Needed for Cpanel::ApacheConf
  11. <IfModule mod_suphp.c>
  12. suPHP_UserGroup username username
  13. </IfModule>
  14. <IfModule !mod_disable_suexec.c>
  15. <IfModule !mod_ruid2.c>
  16. SuexecUserGroup username username
  17. </IfModule>
  18. </IfModule>
  19. <IfModule mod_ruid2.c>
  20. RUidGid username username
  21. </IfModule>
  22. ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
  23.  
  24.  
  25. # To customize this VirtualHost use an include file at the following location
  26. # Include "/usr/local/apache/conf/userdata/std/2/username/domain.com/*.conf"
  27.  
  28. </VirtualHost>
  29.  
  30. SSL
  31.  
  32. <VirtualHost x.x.x.x:443>
  33. ServerName *.domain.com
  34. VirtualDocumentRoot /home/username/public_html/subdomains/%1/
  35. ServerAdmin webmaster@domain.com
  36. UseCanonicalName Off
  37. CustomLog /usr/local/apache/domlogs/domain.com combined
  38. CustomLog /usr/local/apache/domlogs/domain.com-bytes_log "%{%s}t%I .\n%{%s}t %O ."
  39. ## User username # Needed for Cpanel::ApacheConf
  40. <IfModule mod_suphp.c>
  41. suPHP_UserGroup username username
  42. </IfModule>
  43. <IfModule !mod_disable_suexec.c>
  44. <IfModule !mod_ruid2.c>
  45. SuexecUserGroup username username
  46. </IfModule>
  47. </IfModule>
  48. <IfModule mod_ruid2.c>
  49. RUidGid username username
  50. </IfModule>
  51. SSLEnable
  52. SSLCertificateFile /etc/ssl/certs/domain.com.crt
  53. SSLCertificateKeyFile /etc/ssl/private/domain.com.key
  54. SSLCACertificateFile /etc/ssl/certs/domain.com.cabundle
  55. ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
  56.  
  57.  
  58. # To customize this VirtualHost use an include file at the following location
  59. # Include "/usr/local/apache/conf/userdata/std/2/username/domain.com/*.conf"
  60.  
  61. </VirtualHost>
  62.  
  63. Ensure www loads same content as non-www
  64.  
  65. ln -s /home/username/public_html /home/username/public_html/subdomains/www
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement