Ako na vlastný server – III. (Konfigurácia Apache2, časť II.)

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.

2 679 Responses to “Ako na vlastný server – III. (Konfigurácia Apache2, časť II.)”

  1. [...]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[...]……

    [...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……

  2. Sites we Like……

    [...] Every once in a while we choose blogs that we read. Listed below are the latest sites that we choose [...]……

  3. Websites we think you should visit…

    [...]although websites we backlink to below are considerably not related to ours, we feel they are actually worth a go through, so have a look[...]……

  4. közösségi portálok…

    [...]below you’ll find the link to some sites that we think you should visit[...]…

  5. Blogs ou should be reading…

    [...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……

  6. σπίτι hovorí:

    Answer for post…

    I saw this really good post today. Thanks you for the post….

  7. basketball drills…

    [...]we like to honor other sites on the web, even if they aren’t related to us, by linking to them. Below are some sites worth checking out[...]…

  8. hello…

    you have a great blog here! would you like to make some invite posts on my blog?…

  9. freight tracking hovorí:

    Awesome website…

    [...]the time to read or visit the content or sites we have linked to below the[...]……

  10. career advice hovorí:

    Thanks…

    Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I …

  11. Links…

    [...]Sites of interest we have a link to[...]……

  12. special damages hovorí:

    [...]Sites of interest we have a link to[...]……

    [...]usually posts some very interesting stuff like this. If you’re new to this site[...]……

  13. interaktiva hovorí:

    Thank you…

    I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post….

  14. Charity Gifts hovorí:

    Thanks…

    Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I …

  15. Informative and precise…

    Its difficult to find informative and precise information but here I found…

  16. Just Browsing…

    While I was surfing yesterday I saw a great post about…

  17. Great links…

    [...] pursuing are a few links to online websites which I actually communicate with because we do recognize these are worthwhile looking into [...]…

  18. Casti de Copiat hovorí:

    Thanks…

    Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I …

  19. Great blog…

    The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about something that you coul…

  20. News info…

    I was reading the news and I saw this really interesting info…

  21. Read was interesting, stay in touch……

    [...]please visit the sites we follow, including this one, as it represents our picks from the web[...]……

  22. Websites worth visiting…

    [...] and also we’re linking out to that site [...]…

  23. SEO hovorí:

    UK’s leading SEO Company…

    Offering a complete range of SEO services to match your budget….

  24. Hello…

    I’ve recently started a website, the info you offer on this website has helped me tremendously. Thank you for all of your time & work. “The achievements of an organization are the results of the combined effort of each individual.” by Vince Lombardi…

  25. My Blog…

    [...]here are some links to sites that we link to because we think they are worth visiting[...]…

  26. hello…

    you have a great blog here! would you like to make some invite posts on my blog?…

  27. Arigatou…

    Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon….

  28. Blogs to read…

    [...] If you are searching for additional info about this situation, addiitional information about today’s problem is accessible on [...]…

  29. Thanks you…

    There are some interesting points in time in this article but I donft know if I see all of them center to heart. There is some validity but I will take hold opinion until I look into it further. Good article , thanks and we want more! Added to FeedBur…

Leave a Reply