Category: General
Apache Virtual Hosts
For multiple domains and subdomains on one IP address
Create a file called vhost.conf in /etc/httpd/conf.d
NameVirtualHost *:80
ServerName $domain
DocumentRoot /var/www/html/$domain
Options Indexes FollowSymLinks +ExecCGI
AllowOverride All
Allow from All
Order Allow,Deny
ServerName $domain2
DocumentRoot /var/www/html/$domain2
Options Indexes FollowSymLinks +ExecCGI
AllowOverride All
Allow from All
Order Allow,Deny
- Set Permissions
chmod 755 /var/www/html/$domain chown apache:apache /var/www/html/$domain
- Restart Apache
Centos 6
service apache restart
Centos 7
systemctl restart httpd
Linux