workshops:apache_virtual_hosts
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
workshops:apache_virtual_hosts [2009/07/19 11:24] – created admin | workshops:apache_virtual_hosts [2017/10/12 21:58] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
Date: 29th May, 2009 | Date: 29th May, 2009 | ||
- | Setting up Virtual Hosts under Apache. | + | ===== Setting up Virtual Hosts under Apache. |
+ | |||
+ | |||
+ | |||
+ | Make sure that the module you need is available. | ||
+ | |||
+ | So first of all we need to check the directory of available modules to see if we have a copy of module vhosts_alias | ||
+ | |||
+ | ls / | ||
+ | |||
+ | < | ||
+ | actions.conf | ||
+ | actions.load | ||
+ | alias.conf | ||
+ | alias.load | ||
+ | asis.load | ||
+ | auth_basic.load | ||
+ | auth_digest.load | ||
+ | authn_alias.load | ||
+ | authn_anon.load | ||
+ | authn_dbd.load | ||
+ | authn_dbm.load | ||
+ | authn_default.load | ||
+ | authn_file.load | ||
+ | authnz_ldap.load | ||
+ | authz_dbm.load | ||
+ | authz_default.load | ||
+ | authz_groupfile.load | ||
+ | authz_host.load | ||
+ | authz_owner.load | ||
+ | authz_user.load | ||
+ | autoindex.conf | ||
+ | autoindex.load | ||
+ | cache.load | ||
+ | cern_meta.load | ||
+ | cgi.load | ||
+ | cgid.conf | ||
+ | cgid.load | ||
+ | charset_lite.load | ||
+ | dav.load | ||
+ | dav_fs.conf | ||
+ | dav_fs.load | ||
+ | dav_lock.load | ||
+ | dbd.load | ||
+ | deflate.conf | ||
+ | deflate.load | ||
+ | dir.conf | ||
+ | dir.load | ||
+ | disk_cache.conf | ||
+ | disk_cache.load | ||
+ | dump_io.load | ||
+ | env.load | ||
+ | expires.load | ||
+ | ext_filter.load | ||
+ | file_cache.load | ||
+ | filter.load | ||
+ | headers.load | ||
+ | ident.load | ||
+ | imagemap.load | ||
+ | include.load | ||
+ | info.conf | ||
+ | info.load | ||
+ | ldap.load | ||
+ | log_forensic.load | ||
+ | mem_cache.conf | ||
+ | mem_cache.load | ||
+ | mime.conf | ||
+ | mime.load | ||
+ | mime_magic.conf | ||
+ | mime_magic.load | ||
+ | negotiation.conf | ||
+ | negotiation.load | ||
+ | perl.load | ||
+ | php5.conf | ||
+ | php5.load | ||
+ | proxy.conf | ||
+ | proxy.load | ||
+ | proxy_ajp.load | ||
+ | proxy_balancer.load | ||
+ | proxy_connect.load | ||
+ | proxy_ftp.load | ||
+ | proxy_http.load | ||
+ | python.load | ||
+ | rewrite.load | ||
+ | setenvif.conf | ||
+ | setenvif.load | ||
+ | speling.load | ||
+ | ssl.conf | ||
+ | ssl.load | ||
+ | status.conf | ||
+ | status.load | ||
+ | substitute.load | ||
+ | suexec.load | ||
+ | unique_id.load | ||
+ | userdir.conf | ||
+ | userdir.load | ||
+ | usertrack.load | ||
+ | version.load | ||
+ | vhost_alias.load # | ||
+ | </ | ||
+ | |||
+ | Next we need to tell apache2 to load the vhosts_alias module | ||
+ | |||
+ | ls / | ||
+ | |||
+ | < | ||
+ | alias.conf | ||
+ | alias.load | ||
+ | auth_basic.load | ||
+ | authn_file.load | ||
+ | authz_default.load | ||
+ | authz_groupfile.load | ||
+ | authz_host.load | ||
+ | authz_user.load | ||
+ | autoindex.conf | ||
+ | autoindex.load | ||
+ | cgi.load | ||
+ | deflate.conf | ||
+ | deflate.load | ||
+ | dir.conf | ||
+ | dir.load | ||
+ | env.load | ||
+ | mime.conf | ||
+ | mime.load | ||
+ | negotiation.conf | ||
+ | negotiation.load | ||
+ | perl.load | ||
+ | php5.conf | ||
+ | php5.load | ||
+ | python.load | ||
+ | setenvif.conf | ||
+ | setenvif.load | ||
+ | status.conf | ||
+ | status.load | ||
+ | vhost_alias.load # | ||
+ | </ | ||
+ | |||
+ | Now we need to setup the enabled sites file to include all the virtual hosts we will be adding. | ||
+ | |||
+ | |||
+ | cat / | ||
+ | |||
+ | < | ||
+ | < | ||
+ | ServerAdmin webmaster@localhost | ||
+ | |||
+ | DocumentRoot /var/www/ | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride None | ||
+ | </ | ||
+ | < | ||
+ | Options Indexes FollowSymLinks MultiViews | ||
+ | AllowOverride AuthConfig | ||
+ | Order allow, | ||
+ | allow from all | ||
+ | </ | ||
+ | UseCanonicalName Off # | ||
+ | VirtualDocumentRoot / | ||
+ | |||
+ | ScriptAlias /cgi-bin/ / | ||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
+ | Order allow, | ||
+ | Allow from all | ||
+ | </ | ||
+ | |||
+ | ErrorLog / | ||
+ | |||
+ | # Possible values include: debug, info, notice, warn, error, crit, | ||
+ | # alert, emerg. | ||
+ | LogLevel warn | ||
+ | |||
+ | CustomLog / | ||
+ | |||
+ | Alias /doc/ "/ | ||
+ | < | ||
+ | Options Indexes MultiViews FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Order deny, | ||
+ | Deny from all | ||
+ | Allow from 127.0.0.0/ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Including VirtualDocumentRoot / | ||
+ | |||
+ | < | ||
+ | ls -la /var/www | ||
+ | total 24 | ||
+ | drwxrwxr-x | ||
+ | drwxr-xr-x 14 root | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | drwxr-xr-x 25 robert robert 4096 May 31 14:45 ares.going-places.org # local Virtual host | ||
+ | drwxr-xr-x | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | -rw-r--r-- | ||
+ | drwxr-xr-x | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | lrwxrwxrwx | ||
+ | </ | ||
+ | |||
+ | |||
+ | As you can see, now all you have to do is put links to your directories | ||
+ | in URL format and it all "just works" | ||
- | Files will be included soon. |
workshops/apache_virtual_hosts.1247966681.txt.gz · Last modified: 2017/10/12 21:58 (external edit)