Tagged: vhosts

Slackware64: Name-Based Web Sites on a Single IP Address (vhosts)

Configuring VirtualHost with Slackware64 13.37 is also relatively easy. This is my local setup.

Uncomment below from /etc/httpd/httpd.conf. This enables virtual host. Include /etc/httpd/extra/httpd-vhosts.conf

Edit /etc/httpd/extra/httpd-vhosts.conf

Note on access control. From Apache version 2.4, Options, Allow, and other directives are replaced by the Require directive. Neglecting to make this change could result in 403 Forbidden You don't have permission to access / on this server. or AH01630: client denied by server configuration... in the error log.

For more detailed information, upgrading overview document is useful. NameVirtualHost *:80 <virtualhost *:80> <directory "/home/ubyt3m3/www/siteA"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted [Edit: To comply with Apache 2.4] </directory> ServerName siteA DocumentRoot "/home/ubyt3m3/www/siteA" ErrorLog "/var/log/httpd/siteA.err" CustomLog "/var/log/httpd/siteA.log" common </virtualhost> <virtualhost *:80> <directory "/home/ubyt3m3/www/siteB"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted [Edit: To comply with Apache 2.4] </directory> ServerName siteB DocumentRoot "/home/ubyt3m3/www/siteB" ErrorLog "/var/log/httpd/siteB.err" CustomLog "/var/log/httpd/siteB.log" common </virtualhost>

Edit /etc/hosts so that the sites can be found by name: 127.0.0.1 siteA siteB

Restart the httpd process: /etc/rc.d/rc.httpd stop /etc/rc.d/rc.httpd start

That's all!
-gibb

Disclaimer:
Information in this page is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.