Apache Virtual Hosts file for WP Multisite
-
Hi, can anyone please help with some info on creating an Apache virtual hosts file for a multisite installation?
The subdomain sites are stored in /wp-content/uploads/sites/2, /wp-content/uploads/sites/3, /wp-content/uploads/sites/4, etc.
My standard virtual hosts file for a single site installation would normally be:
<VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/ ErrorLog /srv/www/example.com/logs/error.log CustomLog /srv/www/example.com/logs/access.log combined Options +ExecCGI AddHandler cgi-script .cgi .pl <Directory /srv/www/example.com/public_html/> AllowOverride all Options +FollowSymLinks Require all granted </Directory> </VirtualHost>
Do I therefore need to create a vhosts file for each individual subdomain like this:
<VirtualHost *:80> ServerAdmin [email protected] ServerName subdomain.example.com ServerAlias subdomain.example.com DocumentRoot /srv/www/example.com/public_html/wp-content/uploads/sites/2 ErrorLog /srv/www/example.com/wp-content/uploads/sites/2/logs/error.log CustomLog /srv/www/example.com/wp-content/uploads/sites/2/logs/access.log combined Options +ExecCGI AddHandler cgi-script .cgi .pl <Directory /srv/www/example.com/public_html/wp-content/uploads/sites/2> AllowOverride all Options +FollowSymLinks Require all granted </Directory> </VirtualHost>
I think I need separate vhosts files for Letsencrypt certs but I don’t know if I need the DocumentRoot, ErrorLog, CustomLog and Directory to link to the folder in which the subdomain site is installed or just use the top level folder as in the vhosts for the main domain.
Many thanks
DBR
- The topic ‘Apache Virtual Hosts file for WP Multisite’ is closed to new replies.