バーチャルホストの追加手順で素人の疑問

このQ&Aのポイント
  • XAMPPをインストールし、教本を参考にバーチャルホストの設定を行ったが、設定内容に自信がない。
  • 疑問点1:ドメインと同じディレクトリを作成する必要があるかどうか
  • 疑問点2:VirtualHostのポート番号を変更できるか
回答を見る
  • ベストアンサー

P30 項目4■ バーチャルホストの追加手順で!?

教本 パーフェクトPHP(以下URLの本)  http://www.amazon.co.jp/dp/4774144371 以上教本~  XAMPPをインストールした後教本見ながら以下、”設定構築”しましたが、  自信がないです。 以下教本を見ながら設定しました。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P28~P29 項目1■ ドキュメントルートの設置      1) ドキュメントルートを C:\xampp\htdocs\にstudy.localhostのデレクトリを設定して、         C:\xampp\htdocs\study.localhostとしました。      2) 次にC:\xampp\apache\conf\extra\httpd-vhosts.confに!Apacheのバーチャルホストに  NameVirtualHost *:80  <VirtualHost *:80> ServerName study.localhost DocumentRoot "C:\xampp\htdocs\study.localhost" DirectoryIndex index.php index.html <Directory "C:\xampp\htdocs\study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost>  を追加しました。    以上設定が完了したら、XAMPPのコントロールパネルからApacheとMysQLを起動します。  項目の右側にあるStartボタンを押せば起動できます。(図14)これでstudy.localhostという  ドメインでApacheにアクセスが来ると、C:\xampp\hotdocs\study.localhos以下のファイルを  閲覧できるようになります。        P29 項目3■ hostsにドメインを設定 バーチャルホストに設定が完了したら、     C:\Windows\System32\drivers\etc\hostsを開き、        127.0.0.1 study.localhostをhostsのプログラムの一番最後に         追加しまいた。 P30 項目4■ バーチャルホストの追加手順        バーチャルホストを追加する際はまずドキュメントルートとなるデレクトリ        を作成します。        a) C:\xampp\htdocs [※1]"以下にドメインと同じ名前のデレクトリを作成" すると分かりやすいでしょう。 次に C:\xampp\apache\conf\extra\httpd-vhosts.confバーチャルホストの設定を追加します。 <VirtualHost>で囲まれた部分をコピーし、ServerName   [※2] <VirtualHost *:80> ServerName localhost DocumentRoot "C:/xampp/htdocs/localhost" DirectoryIndex index.php index.html <Directory "C:/xampp/htdocs/localhost"> AllowOverride All Allow from All </Directory>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   以上の設定を参考にされて、以下の質問のですが!       P30 項目4■ バーチャルホストの追加手順 の項目で質問があります。       (素人の質問なので、内容的に不備はご了承ください。)     問い1 [※1]のドメインと同じとありますが、P28~P29の      1)でstudy.localhostのデレクトリが存在しているので     とりあえず localhostのデレクトリを追加したのですが、         設定的には間違いないでしょうか!? 問い2 [※2] <VirtualHost *:80>の80を81に変更しなくていいでしょうか!? 問い3 [※2]全てlocalhostにしましたが、間違いないでしょうか!?      問い4 P29 項目3■ 「hostsにドメインを設定」      バーチャルホストとしての機能したいのであれば      新たに"127.0.0.2 localhost"を追加しなくていいのでしょうか、      教本には、特に追加事項はないのですが、設定の流れからして      追加したい気持ちですが、間違いでしょうか!?               以上ですが、他にご指導ご鞭撻はございませんでしょうか!?         4問ですが、宜しくお願い致します。

質問者が選んだベストアンサー

  • ベストアンサー
回答No.1

今現在のhttpd-vhosts.confはどうなってるんですか? 参考書の説明と、あなたが設定した内容が入り乱れていて、 どれが今の状態なのかわかりません。

arimurajyu
質問者

補足

レス・ご回答有難うございました。  以下httpd-vhosts.confの中身です。  以下宜しくお願いします。 # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 <VirtualHost *:80> ServerName study.localhost DocumentRoot "C:/xampp/htdocs/study.localhost" DirectoryIndex index.php index.html <Directory "C:/xampp/htdocs/study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost> <VirtualHost *:80> ServerName localhost DocumentRoot "C:/xampp/htdocs/localhost" DirectoryIndex index.php index.html <Directory "C:/xampp/htdocs/study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost> ##NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ##ServerName or ##ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost> ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost>

関連するQ&A

  • P30 項目4■ バーチャルホストの追加手順で!?

    P30 項目4■ バーチャルホストの追加手順で!? 教本 パーフェクトPHP(以下URLの本) http://www.amazon.co.jp/dp/4774144371 以上教本~ XAMPPをインストールした後教本見ながら以下、”設定構築”しましたが、 自信がないです。 以下教本を見ながら設定しました。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P28~P29 項目1■ ドキュメントルートの設置 1) ドキュメントルートを C:\xampp\htdocs\にstudy.localhostのデレクトリを設定して、 C:\xampp\htdocs\study.localhostとしました。 2) 次にC:\xampp\apache\conf\extra\httpd-vhosts.confに!Apacheのバーチャルホストに NameVirtualHost *:80 <VirtualHost *:80> ServerName study.localhost DocumentRoot "C:\xampp\htdocs\study.localhost" DirectoryIndex index.php index.html <Directory "C:\xampp\htdocs\study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost> を追加しました。 以上設定が完了したら、XAMPPのコントロールパネルからApacheとMysQLを起動し ます。 項目の右側にあるStartボタンを押せば起動できます。(図14)これでstudy.localhostと いうドメインでApacheにアクセスが来ると、C:\xampp\hotdocs\study.localhos以下の ファイルを 閲覧できるようになります。 P29 項目3■ hostsにドメインを設定 バーチャルホストに設定が完了したら、 C:\Windows\System32\drivers\etc\hostsを開き、 127.0.0.1 study.localhostをhostsのプログラムの一番最後に 追加しまいた。 P30 項目4■ バーチャルホストの追加手順 バーチャルホストを追加する際はまずドキュメントルートとなるデレクトリ を作成します。 a) C:\xampp\htdocs [※1]"以下にドメインと同じ名前のデレクトリを作成" すると分かりやすいでしょう。 次に C:\xampp\apache\conf\extra\httpd-vhosts.conf バーチャルホストの 設定を追加します。 http://homepage3.nifty.com/mtaiyo/httpd-vhosts.conf(←ファイヘルリンク) <VirtualHost>で囲まれた部分をコピーし、ServerName やDocumentRootの値 を書き換えて保存した後、Apacheを再起動します。また、必要に合わせてC:\Windows\System32\drivers\etc\hosts ドメイン指定を追加します。 [※2] <VirtualHost *:80> ServerName localhost DocumentRoot "C:/xampp/htdocs/localhost" DirectoryIndex index.php index.html <Directory "C:/xampp/htdocs/localhost"> AllowOverride All Allow from All </Directory>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  以上の設定を参考にされて、以下の質問のですが!       P30 項目4■ バーチャルホストの追加手順 の項目で質問があります。       (素人の質問なので、内容的に不備はご了承ください。) 問い1 [※1]の“ドメインと同じ名前のデレクトリを作成"  すると、とありますが、意味がよくわかりません!      それで、P28~P29の      1)でstudy.localhostのデレクトリが存在しているので      とりあえず localhostのデレクトリを追加したのですが、      設定的には間違いないでしょうか!? 問い2 [※2] <VirtualHost *:80>の80を81に変更しなくていいでしょうか!? 問い3 [※2]全てlocalhostにしましたが、間違いないでしょうか!?      問い4 P29 項目3■ 「hostsにドメインを設定」      バーチャルホストとしての機能したいのであれば      新たに"127.0.0.2 localhost"を追加しなくていいのでしょうか、      教本には、特に追加事項はないのですが、設定の流れからして、      追加したい気持ちですが、間違いでしょうか!?               以上ですが、他にご指導ご鞭撻はございませんでしょうか!?         4問ですが、宜しくお願い致します。

  • クライアントサーバー型である私のパソコンに

    クライアントサーバー型である私のパソコンに  study.localhostに”sample2.html”のファイルを設置しました。   私のパソコンから  以下のアドレスで、  http://localhost/sample2.html  とアドレスバーに入力ししたら  ちゃんとファイルが開きました。  これって、部外からも接続できる、グローバル的なURLでしょうか!?  教本通りに設定していくと、みんな同じURLになると思うのですが!?     それはあり得ない話と思うのですが、どんなして、区別しているのでしょうか!?      ふと、疑問に思いました。   以上  知識がなくて、理解していない素人の質問なので、馬鹿げた質問だと   玄人方々は、思われると思いますが、宜しくお願い致します。    以下の項目はApacheの設定が、以下の項目まで終わっています。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   教本 パーフェクトPHP(以下URLの本)  http://www.amazon.co.jp/dp/4774144371 以上教本の P28 項目1■ ドキュメントルートの設置(ホームページのファイル・フォルダ入れるフォルダ) 1) ドキュメントルートを C:\xampp\htdocs\study.localhostに設定しました。 2) 次に!Apacheのバーチャルホストを設定(以上で設置したstudy.localhostまでの C:\xampp\apache\conf\extra\httpd-vhosts.confに NameVirtualHost *:80 <VirtualHost *:80> ServerName study.localhost DocumentRoot "C:\xampp\htdocs\study.localhost" DirectoryIndex index.php index.html <Directory "C:\xampp\htdocs\study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost> を追加しました。        P29 項目3■ hostsにドメインを設定     C:\Windows\System32\drivers\etc\hosts    のファイルに最後に、 127.0.0.1 study.localhost を追加 P30 項目4■ バーチャルホストの追加手順         a) C:\xampp\htdocs\httpへstudy.localhostのフォルダを追加した。

  • バーチャルホストで、同htmlファイルが表示される

    バーチャルホストを作成しました。 http://wp.yat-net.com/?p=2400 http://likealunatic.jp/2008/05/16_xampp.php の様のページを参考にし、バーチャルドメインを設定しました。 【1.httpd.conf】  Include "conf/extra/httpd-vhosts.conf" ←有効 【2.httpd-vhosts.con :2つのバーチャルホスト作成】 <VirtualHost *:80>  DocumentRoot C:/xampp/htdocs  ServerName localhost  ErrorLog "logs/error.log"  CustomLog "logs/error.log" common </VirtualHost> <VirtualHost *:80>  DocumentRoot C:/xampp/htdocs/test/doc  ServerName wordpress.localhost  ErrorLog "logs/error.log"  CustomLog "logs/error.log" common </VirtualHost> 【3.hostsの設定】  127.0.0.1 localhost  127.0.0.1 wordpress.localhost 【4.index.htmlを作成】   C:/xampp/htdocs/index.html ⇒ aaaaa と記述したもの   C:/xampp/htdocs/test/doc ⇒ eeeee と記述したもの 【5.ブラウザからアクセス】  http://wordpress.localhost/index.html  http://localhost/index.html 【6.結果】 「http://wordpress.localhost/index.html」「http://localhost/index.html」のどちらでアクセスしても、 「C:/xampp/htdocs/index.html」の内容(aaaaa)が表示されます。 <質問> なぜ、「http://wordpress.localhost/index.html」でアクセスした際に、eeeeのindex.htmlファイルが 表示されないのでしょうか…。 環境は「Win7、Xampp1.7.7で Apache/2.2.21 」になります。

  • 教本 パーフェクトPHP(以下URLの本)

    教本 パーフェクトPHP(以下URLの本)  http://www.amazon.co.jp/dp/4774144371 以上教本の P30!の  「■バーチャルホストの追加手順」があります。  以下中身の内容です。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   バーチャルホストを追加する際はまずドキュメントルートとなるデレクトリを作成します。  C:¥xampp\htdocs以下に※ドメインと同じ名前 のデェレクトリを作成すると分かりやすいでしょう。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 以上ですが! ”C:¥xampp\htdocs以下にドメインと同じ名前のデェレクトリを作成すると分かりやすい”  とあります。    P29の直ぐ前のページに 「■hostsにドメインを設定」があります。  以下中身の内容です。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    バーチャルのホストの設定が完了したら    C:\Windows\System32\drivers\etc\hostsを    開き、次の1文を追加します。    127.0.0.1 study.localhost ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 以上から判断して、この教本が言いたいことは!?     教本の P30!の  「■バーチャルホストの追加手順」の項目の    ”※ドメインと同じ名前のデェレクトリ”名は     「study.localhost」にしろ!との、ことでしょうか!? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   理解に苦しんでいます(;一_一)   以上宜しくお願い致します。

  • 読解力がなくて_ かなり、内容を理解するのが!

    教本 パーフェクトPHP(以下URLの本)  http://www.amazon.co.jp/dp/4774144371 以上教本の P30!の  「■バーチャルホストの追加手順」があります。  以下中身の内容です。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   バーチャルホストを追加する際はまずドキュメントルートとなるデレクトリを作成します。  C:¥xampp\htdocs以下に※ドメインと同じ名前 のデェレクトリを作成すると分かりやすいでしょう。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 以上ですが! ”C:¥xampp\htdocs以下にドメインと同じ名前のデェレクトリを作成すると分かりやすい”  とあります。    P29の直ぐ前のページに 「■hostsにドメインを設定」があります。  以下中身の内容です。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    バーチャルのホストの設定が完了したら    C:\Windows\System32\drivers\etc\hostsを    開き、次の1文を追加します。    127.0.0.1 study.localhost ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 以上から判断して、この教本が言いたいことは!?       教本の P30!の  「■バーチャルホストの追加手順」の項目の    ”※ドメインと同じ名前のデェレクトリ”名は     「study.localhost」にしろ!との、ことでしょうか!? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   私は、読解力がないので_ _ かなり、内容的を理解するの  に時間がかかり過ぎ、なかなか先に進まないのが現状です。   以上宜しくお願い致します。        

  • apacheのバーチャルホストの設定について

    XAMPPを一通りインストールして、apacheでバーチャルホストの設定を行っております。 環境:Windows2003server ApacheFriends XAMPP (Basispaket) version 1.7.1 + Apache 2.2.11 固定のグローバルIPアドレスは1つ持っており、仮に111.222.333.444としておきます。 バーチャルホストのドメイン名は2つ設定したいと思っており、 aaa.hogehoge.net bbb.hogehoge.net 他業者のDNSにて111.222.333.444をAレコードの値として、それぞれ割り当てしました。 ちなみに、hogehoge.netのAレコードは別のサーバーを当てています。 そこで、携帯から直接 http://aaa.hogehoge.netとhttp://bbb.hogehoge.net をアクセスしましたら、自社サーバーのC:/xampp/htdocs/にあるindex.htmが表示されました。 一応、名前解決は成功したとして、、、 念のため、Windowsのhostsに 111.222.333.444  aaa.hogehoge.net  bbb.hogehoge.net を追加しました。 apacheのメイン設定-httpd.conf ------------------------------ ServerRoot "C:/xampp/apache" Listen 80 ServerAdmin admin@localhost ServerName localhost:80 DocumentRoot "C:/xampp/htdocs/" ↓バーチャルホストのファイルをインクルード Include conf/extra/httpd-vhosts.conf ----以下、httpd-vhosts.confの中身 ホスト名を2つ設定 NameVirtualHost 111.222.333.444:80 <VirtualHost 111.222.333.444:80> ServerAdmin admin@aaa.hogehoge.net DocumentRoot C:/xampp/htdocs/aaa.hogehoge.net ServerName aaa.hogehoge.net ServerAlias www.aaa.hogehoge.net <Directory "C:/xampp/htdocs/aaa.hogehoge.net"> Options FollowSymLinks Includes ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost 111.222.333.444:80> ServerAdmin admin@bbb.hogehoge.net DocumentRoot C:/xampp/htdocs/bbb.hogehoge.net ServerName bbb.hogehoge.net ServerAlias www.bbb.hogehoge.net <Directory "C:/xampp/htdocs/bbb.hogehoge.net"> Options FollowSymLinks Includes ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> 設定後、apacheを再起動して、再度携帯電話からhttp://aaa.hogehoge.netとhttp://bbb.hogehoge.netにアクセスしたのですが、C:/xampp/htdocs/にあるindex.htmが表示されてしまい、C:/xampp/htdocs/aaa.hogehoge.net/index.htm、C:/xampp/htdocs/aaa.hogehoge.net/index.htmが表示されません。それぞれのパーミッション自体は766になっているので、こちらは違うと思うのですが、バーチャルホストの設定が悪いのか何処が悪いのか、何か設定が悪いのか全くわからなくなりました。参考書のマニュアルを見ると、「バーチャルホストを設定すると、メインホストの設定が無効になる」と書いてあったので、それでもメインのホストが表示されてしまうということは、バーチャルホストの設定に問題があるのだと自分なりに察知しております。 どなたか、考えられる原因や心当たりある事がございましたら、ご教授をお願いします。

  • パーパーフェクトPHP[技術評論社]のP29まで終

    パーフェクトPHP[技術評論社]のP29まで終わりました。 次に、P30に入りました。そこで! 以下教本の中身です。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ■バーチャルホストの追加手順  バーチャルホストを追加する際はまずドキュメントルートとなるデレクトリを作成します。 C:\xampp\apache\conf\extra\httpd-vhosts.confにバーチャルホストの設定を追加します。 <VirtualHost>で囲まれた部分をコピーして、ServerNameやDocumentRootの値を書き かえて保存した後、Apacheを再起動します。また、必要に合わせて C:\Windows\System32\drivrs\etc\hostsにドメインの指定を追加します。  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  以上ですが、  「<VirtualHost>で囲まれた部分をコピーして、ServerNameやDocumentRootの値を書き かえて保存します」  とありますが! 「※何をやるのか!意味がまったく分かりません!?」  以下が、C:\xampp\apache\conf\extra\httpd-vhosts.conf  のファイルの中身の 「ServerNameやDocumentRootの値を書き かえ」は  教本・パーフェクトPHP P28の「ドキュメントルートの設定」 で、既に終了しているのでは!ないでしょうか!? 素人の考えですが、「※間違いでしょうか」  ・・\httpd-vhosts.confの  ファイルの現在のプログラムの中身です。宜しくお願いします。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 <VirtualHost *:80> ServerName study.localhost DocumentRoot "C:/xampp/htdocs/study.localhost" DirectoryIndex index.php index.html <Directory "C:/xampp/htdocs/study.localhost"> AllowOverride All Allow from All </Directory> </VirtualHost> ##NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ##ServerName or ##ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost> ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost>

    • ベストアンサー
    • PHP
  • Apacheバーチャルホスト外部公開

    Xampp2.5(Apache HTTPD 2.0.52)の環境です。 【バーチャルドメイン設定】 <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/test" ServerName test.ddo.jp </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/hoge" ServerName hoge.ddo.jp </VirtualHost> とhttpd-vhosts.confに設定しております。 これら2つのバーチャルホストを、インターネットに公開したいと考えております。 「test.ddo.jp」がリアルドメインと想定した場合、 どのような設定をすればよいのでしょうか? フリーの「http://ddo.jp/」ダイナミックDNSを使用して、ルーターのグローバルIPアドレス1つで 2つのバーチャルホストを外部公開することは可能なのでしょうか?(NAPT変換です) <今不思議に思ってること。ルーターグローバルIPを123.123.123.123で考えています> 1.外のユーザーが「test.ddo.jp/ページ名」「hoge.ddo.jp/ページ名」でアクセスした場合、  「test・hoge」共に、「123.123.123.123/ページ名」に変える必要がある?  (名前が異なるのに、同じIPに関連付けが可能なのか?)  <質問>  ・ただ、「一つのIPに、名前の異なる二つのドメインをくっつけるにはどうしたらよいのか?」   ⇒もしかして、「ddo.jp」等のサイトで、1つのグローバルIPに対して、     使用する「test」と「hoge」の二つを登録するのでしょうか?  ・どこのDNSサーバーで、何の作業をすれば良いのか?? どのように設定すると、バーチャルホスト2つを公開することができるのでしょうか? 1つのグローバルIPでは無理なのでしょうか? ご教授よろしくお願いします。  

  • PHPの教本の説明などで質問があります。

    http://www.amazon.co.jp/dp/4774144371  以上教本の、P28~P29の質問です。  以下中身です。 ■ドキュメントの設定 ドキュメントルールをC:\xampp\htdocs\study.localhostに設定します。まずはディレクトリを作成します。  次にApacheのバーチャルホストを設定します。C:\xampp\apache\conf\conf\extra\http-vhost.conf を開き次の設定を追加してください。<VirtualHost>で囲まれた部分がバーチャルホストの設定です。ServerNameにWeb ブラウザからアクセスする際のドメイン名(study.localhost)、DocumentRootおよび<Directory>にドキュメントルートへの パスを指定します。 (パソコン側のファイルを以下のプログラムに修正しろと言うことでしょう!?)  NameVirtualHost *:80 <Virtualhost *80> ServerName study.localhost DocumentRoot C:\xampp\htdocs\study.localhost DirectoryIndex index.php index.html <Directory “C:\xampp\htdocs\study.localhost”> AllowOverride All Allow from All </Directory> </VirtualHost> ---------------------------------------------------------- 以上が教本の中身です。 そこで質問があります! 第一の質問  教本では C:\xampp\apache\conf\conf\extra\http-vhost.confですが! パソコン側に存在するファイルは httpd-vhosts.confです。 教本のhttp-vhost.confではなくて、httpの部分がパソコン側では httpdと成っていて、dが多いです! ファイル名が違うことで、設定後何か支障はありますか!? 第二の質問  以下が、httpd-vhosts.conf  ファイルのプログラム全文を以下表示しましたが、 ##NameVirtualHost *:80が二個存在していて、どちらのプログラムを 修正すればいいのでしょうか!?  以上二件よろしくお願いします。 # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # ##NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ##ServerName or ##ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost> ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost>

    • 締切済み
    • PHP
  • Windowsバーチャルホストからの外部アクセス

    ●Windowsにxampp + apacheを導入し、バーチャルホストを設定します。 ●NICカードを2枚差し、それぞれに192.168.1.1、及び192.168.1.2のIPを割り振ります。 ●IPベースのバーチャルホストを設定し、下記のようにします。 <VirtualHost 192.168.1.10:80> ServerName www.aho.jp DocumentRoot "D:/xampp/htdocs/aho" </VirtualHost> <VirtualHost 192.168.1.20:80> ServerName www.ahoaho.jp DocumentRoot "D:/xampp/htdocs/ahoaho" </VirtualHost> 最後に、ルーター内部でグローバルIPとローカルIPを結びつけ、80番ポートを開放します。 192.168.1.10 = 202.202.202.1 192.168.1.20 = 202.202.202.2 これで、外部からアクセスすると、 www.aho.jp(202.202.202.1) www.ahoaho.jp(202.202.202.2) として、それぞれに設定したホームページが表示されます。 さて、ここからが質問です。 "D:/xampp/htdocs/aho"直下に「外部のサーバーにアクセスするwindows用ソフト1」をインストールします。 "D:/xampp/htdocs/ahoaho"直下にも同様に「外部のサーバーにアクセスするwindows用ソフト2」をインストールします。 この状態でそれぞれのソフトを起動します。 【質問】 aho直下のソフト1、及びahoaho直下のソフト2からそれぞれアクセスされた外部サーバーは、 「ソフト1からのアクセスはIPアドレス202.202.202.1から、ソフト2からのアクセスはIPアドレス202.202.202.2からアクセスされたと理解する」ものなのでしょうか? 80番ポートを外部に開放した場合どうなるか、80番ポートを外部に開放しなかった場合どうなるかについて教えてください。 宜しくお願い致します。