さくらのVPSを使ってみる【8】-VirtualHost(バーチャルホスト)の設定をしてみる

8月 26th, 2011 カテゴリー さくら VPS

独自ドメインの設定を行なったので、
複数ドメイン(サブドメイン)でも流用できるようにVirtualHostの設定をしてみたいと思います。


1)ディレクトリ構成

管理しやすいようにvirtualhost用のディレクトリを用意して、その中に各ドメイン用のディレクトリを作成します。

/var/virtualhost/example.com/html
/var/virtualhost/sub.example.com/html



2)httpd.confの設定

次にVirtualHostの設定をhttpd.confに記入します。
後から設定をしやすくする為に別ファイルにします。
※/etc/httpd/conf.d/ 内の ~.conf ファイルはhttpd起動時に自動で読み込まれます。
sudo vi /etc/httpd/conf.d/vhost.conf

httpd.conf
NameVirtualHost *:80

<VirtualHost *:80>
	DocumentRoot /var/virtualhost/example.com/html
	ServerName example.com
	ServerAlias www.example.com
	ErrorLog /var/log/httpd/example.com/error_log
	CustomLog /var/log/httpd/example.com/access_log combined
	<Directory "/var/virtualhost/example.com/html">
		AllowOverride All
	</Directory>
</VirtualHost>

#サブドメイン
<VirtualHost *:80>
	DocumentRoot /var/virtualhost/sub.example.com/html
	ServerName sub.example.com
	ErrorLog /var/log/httpd/sub.example.com/error_log
	CustomLog /var/log/httpd/sub.example.com/access_log combined
	<Directory "/var/virtualhost/sub.example.com/html">
		AllowOverride All
	</Directory>
</VirtualHost>
※/var/log/httpd/ 以下に各ドメインのディレクトリを作っておきます。

設定ファイルを保存したら、httpdを再起動します。

sudo /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

これでokです!



⇒ さくらのVPSを使ってみる【9】-vsftpdをインストールしてみる

Sponsored Links

コメント

コメントする

  1. Deeyneiol より:

    gay bi text chat
    gay chat roulettye
    gay and bi text chat

  2. Gennieeiol より:

    gay chat websites
    [url="https://chatcongays.com"]gay chat rooms free[/url]
    gay chat cahurbate

  3. Marriseiol より:

    cheap essays
    [url="https://au-bestessays.org"]admissions essay help[/url]
    help writing a essay for college

  4. Dorolisaeiol より:

    the help essay on racism
    [url="https://bestcampusessays.com"]custom essays essay help[/url]
    custom essay writing reviews

  5. Martyeiol より:

    write my essay today
    [url="https://besteasyessays.org"]help writing a narrative essay[/url]
    essay writing services singapore

  6. Merolaeiol より:

    premium essay writing service
    [url="https://bestessayreviews.net"]what is the best college essay editing service[/url]
    help with writing essay

  7. Ashleneiol より:

    help writing a argumentative essay
    [url="https://bestessaysden.com"]hire essay writer[/url]
    mba essay service

  8. the euro game slot free 777 slots casino slots era cheats casino slots online|

  9. Charitaeiol より:

    help with writing essay
    [url="https://bestsessays.org"]custom essay service toronto[/url]
    do essay writing services work

  10. Naniceeiol より:

    psychology essay writing services
    [url="https://buyacademicessay.com"]write my essay online[/url]
    essay writer reddit

  11. Chelsaeeiol より:

    help writing college essay
    [url="https://buy-eessay-online.com"]service learning reflection essay[/url]
    cat essay writer

  12. Pennyeiol より:

    essay title help
    [url="https://buytopessays.com"]helping others essay[/url]
    order cheap essay

  13. Tammieeiol より:

    custom writing essay service
    [url="https://cheapessaywritingservice1.com"]custom essay station[/url]
    essay help forum

  14. Antonieeiol より:

    can t write my essay
    [url="https://customcollegeessays.net"]essay writing service scam[/url]
    good essay writing website

  15. Rhiamoneiol より:

    buying essays
    [url="https://customessays-writing.org"]english essay writing help[/url]
    custom college essays

  16. Charoeiol より:

    application essay help
    [url="https://customessaywwriting.com"]essay writing help for students[/url]
    buy custom essay

  17. Twylaeiol より:

    college admission essay help
    [url="https://firstessayservice.net"]custom my essay[/url]
    buy essay online cheap

  18. do my paper より:

    can i pay someone to write my paper college paper writer help with writing papers do my paper

  19. Leilaheiol より:

    essay revision help online
    [url="https://geniusessaywriters.net"]cheap essay papers[/url]
    scholarship essay writing help

  20. Cthrineeiol より:

    professional essay editing service
    [url="https://howtobuyanessay.com"]psychology essay writing services[/url]
    order custom essays online

  21. papers writing service paper writer service
    pay for someone to write your paper online paper writing services

  22. paper writers online write my math paper buy paper online scientific paper writing services

  23. pay to write papers help write my paper write my paper cheap buying papers for college

  24. Ginnieeiol より:

    essay help websites
    [url="https://lawessayhelpinlondon.com"]write my college essay[/url]
    buy an essay cheap

  25. Ginnieeiol より:

    admission college essay help
    [url="https://lawessayhelpinlondon.com"]college essay services[/url]
    essay writing services us

  26. buy cheap papers need help with paper paper writing services reviews paper writing services online

  27. pay to write a paper write my paper for me fast write my paper for me in 3 hours term-paper-help.org

  28. Vivieneeiol より:

    custom essay paper
    [url="https://ukessayservice.net"]professional essay help[/url]
    history essay help

  29. professional paper writing services write my paper canada
    help in writing paper i need help writing a paper

  30. Eastereiol より:

    recommended essay writing service
    [url="https://writemyessaycheap24h.com"]personal essay writers[/url]
    essay help websites

  31. do my papers より:

    help paper write my english paper buy papers online cheap do my papers

  32. best paper writing service reviews apa papers for sale write
    my philosophy paper what are the best paper writing services

  33. best paper writing service reviews order papers online write my nursing paper custom thesis papers

  34. help with paper writing papers writing help where can i find someone to write my paper professional paper writing services

  35. can someone write my paper help with college paper writing paper writing services for college students paper help writing

  36. help with your paper academic paper writing services paper
    writing help online help with paper writing

  37. website that will write a paper for you https://paperwritinghq.com/

  38. Marriseiol より:

    buy essays for college
    [url="https://au-bestessays.org"]write my essay org[/url]
    college admissions essay help

  39. Dorolisaeiol より:

    essays about community service
    [url="https://bestcampusessays.com"]websites for essay writing[/url]
    best online essay writing services

  40. Martyeiol より:

    great essay writers
    [url="https://besteasyessays.org"]the help essays[/url]
    best online essay writers

  41. Merolaeiol より:

    personal essay writing service
    [url="https://bestessayreviews.net"]custom admission essay[/url]
    best custom essay writing service

  42. coursework like copa coursework meaning in english quantitative coursework examples coursework computer science

  43. Ashleneiol より:

    help essay writing
    [url="https://bestessaysden.com"]descriptive essay help[/url]
    online essay helper

  44. course work hero coursework examination help with coursework coursework meaning

  45. coursework example coursework que significa do my coursework
    for me coursework jelentése

  46. Charitaeiol より:

    help write essay
    [url="https://bestsessays.org"]premium essay writing service[/url]
    my essay writer

  47. Naniceeiol より:

    help write essay for me
    [url="https://buyacademicessay.com"]essay writing company[/url]
    service to others essay

  48. Chelsaeeiol より:

    who can help me write an essay
    [url="https://buy-eessay-online.com"]best rated essay writing service[/url]
    help my essay

  49. Pennyeiol より:

    help with writing college essays
    [url="https://buytopessays.com"]write my college essay me[/url]
    in an essay help you guide

コメントする

Eメールアドレスは公開されません。