Poslednou časťou Apache bude časť pomenovaná “Virtual Hosts”. Virtual Hosts umožňuje spúšťanie niekoľkých virtuálnych častí na jednom fyzickom stroji. V tejto časti si ukážeme ako pridáme doménu do Apache2.
Na úvod je potrebné mať v apache zapnutý modul vhost_alias, pokiaľ sme už tak neurobili, modul nainštalujeme príkazom a2enmod vhost_alias a reštartujeme apache /etc/init.d/apache2 restart.
Apache je defaultne nastavené tak aby sme ukladali všetky virtual hosty do /etc/apache2/sites-available/ a spravili najlepsie symlink do /etc/apache2/sites-enabled/ . Symlink vytvoríme cp /etc/apache2/sites-available/example.com /etc/apache2/sites-enabled/example.com .
nano /etc/apache2/sites-available/example.com
vložíme
ServerAdmin admin@example.com
ServerName example.com
ServerAlias *.example.com
DirectoryIndex index.html index.php
php_admin_value open_basedir /var/www/example.com/:/tmp/
VirtualDocumentRoot /var/www/%-2.0.%-1.0/htdocs/%-3
#Logfiles
#ErrorLog /var/www/example.com/logs/error.log
#CustomLog /var/www/example.com/logs/access.log combined
Vytvoríme symlink
cp /etc/apache2/sites-available/example.com /etc/apache2/sites-enabled/example.com
Dôležité časti example.com
php_admin_value open_basedir /var/www/example.com/:/tmp/
Nastaví open_basedir.
VirtualDocumentRoot /var/www/%-2.0.%-1.0/htdocs/%-3
Z priečinku sa nám načítavajú dáta. %-2.0.%-1.0 znamená názov domény.
#ErrorLog /var/www/example.com/logs/error.log
#CustomLog /var/www/example.com/logs/access.log combined
Možnosť zapnúť vlastné logy domény.
Poznámka: Subdomény sa vytvárajú vytvorením priečinka v htdocs, root domény je v htdocs/www
Doménu po vytvoreni v sites-available je možné zapnúť aj príkazom a2ensite a znovu načítať Apache.
swiss replica watches…
[...]Sites of interest we’ve a link to[...]…
replica watches…
[...]just beneath, are many entirely not connected sites to ours, even so, they’re certainly worth going over[...]…
Websites worth visiting…
[...]here are some links to sites that we link to because we think they are worth visiting[...]……
Recent Blogroll Additions……
[...]usually posts some very interesting stuff like this. If you’re new to this site[...]……
free cell phone…
[...]The info talked about inside the post are a few of the top readily available [...]…
Not a chance……
[...] entails fairly long time for building great results. One must have real persistence [...]…