Difference between revisions of "Apache"
From Bashlinux
(→Apache) |
|||
Line 1: | Line 1: | ||
__NOTOC__ |
__NOTOC__ |
||
== How to serve multiple virtual hosts with one configuration file == |
== How to serve multiple virtual hosts with one configuration file == |
||
− | + | The following Apache configuration is useful to serve web content for multiple users from their home folder but with only one configuration file |
|
⚫ | |||
− | <pre><nowiki> |
||
⚫ | |||
⚫ | |||
⚫ | |||
<VirtualHost *:80> |
<VirtualHost *:80> |
||
− | + | ServerName bashlinux.com |
|
− | + | ServerAlias *.bashlinux.com |
|
+ | |||
− | |||
− | + | VirtualDocumentRoot /home/%1/htdocs |
|
− | + | VirtualScriptAlias /home/%1/cgi-bin |
|
− | + | ||
− | + | <Directory /> |
|
− | Options -Indexes FollowSymLinks -MultiViews |
+ | Options -Indexes FollowSymLinks -MultiViews |
− | AllowOverride All |
+ | AllowOverride All |
− | Order allow,deny |
+ | Order allow,deny |
− | Allow from all |
+ | Allow from all |
− | + | </Directory> |
|
− | + | ||
− | + | <DirectoryMatch "^/home/[^/]+/cgi-bin"> |
|
− | AllowOverride None |
+ | AllowOverride None |
− | Options ExecCGI |
+ | Options ExecCGI |
− | + | </DirectoryMatch> |
|
</VirtualHost> |
</VirtualHost> |
||
− | </nowiki></pre> |
Revision as of 03:08, 3 June 2015
How to serve multiple virtual hosts with one configuration file
The following Apache configuration is useful to serve web content for multiple users from their home folder but with only one configuration file
UseCanonicalName Off <VirtualHost *:80> ServerName bashlinux.com ServerAlias *.bashlinux.com VirtualDocumentRoot /home/%1/htdocs VirtualScriptAlias /home/%1/cgi-bin <Directory /> Options -Indexes FollowSymLinks -MultiViews AllowOverride All Order allow,deny Allow from all </Directory> <DirectoryMatch "^/home/[^/]+/cgi-bin"> AllowOverride None Options ExecCGI </DirectoryMatch> </VirtualHost>