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

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.