DeveloperBreeze

Tutorials Programming Tutorials, Guides & Best Practices

Explore 148+ expertly crafted tutorials tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Adding a Subdomain on an Apache Server

Tutorial August 21, 2024

   <VirtualHost *:80>
       ServerAdmin admin@example.com
       ServerName blog.example.com
       DocumentRoot /var/www/blog.example.com

       <Directory /var/www/blog.example.com>
           Options Indexes FollowSymLinks
           AllowOverride All
           Require all granted
       </Directory>

       ErrorLog ${APACHE_LOG_DIR}/blog.example.com-error.log
       CustomLog ${APACHE_LOG_DIR}/blog.example.com-access.log combined
   </VirtualHost>
  • ServerAdmin: Your email address or the administrator’s email address.
  • ServerName: The subdomain you are setting up (blog.example.com).
  • DocumentRoot: The directory where your subdomain’s files are located.