• 締切済み

XAMPP ヴァーチャルホストの設定について

以下は、httpd-vhosts.conf 初期状態のものを、コメントアウトし、 host、httpd.conf の設定、 モジュール関連箇所のコメントアウトをして、 正常に dummy-host.localhost で見れています。 ただ、 dummy-host.localhost というドット区切りのディレクトリを作成しなければ、 ドットで区切った URLで、見れないのでしょうか? 例えば、ドット区切りのない、 /dummy" というディレクトリを作り、 trunk.dummy では、503エラーが表示します。 (その他ファイルの必要な設定は変更しています.。一部の抜粋だけですみません。) ドット区切りのないディレクトリで、ドット区切りの URL で見れる設定方法が、あれば ご教授ください。 それ以前に、私が大きな勘違いをしている等もありますので、ご了承ください。 ( httpd-vhosts.conf の内容 ) <VirtualHost *:80> ServerAdmin postmaster@dummy-host.localhost DocumentRoot "/xampplite/htdocs/dummy-host.localhost" ServerName dummy-host.localhost ServerAlias www.dummy-host.localhost ErrorLog "logs/dummy-host.localhost-error.log" CustomLog "logs/dummy-host.localhost-access.log" combined </VirtualHost>

みんなの回答

  • t_ohta
  • ベストアンサー率38% (5076/13258)
回答No.3

> 私もその方法で設定してますが、 503 エラーとなります。 エラーが出た時にApacheのアクセスログ、エラーログにはどのようなメッセージが出ていますか? 503 は過負荷等でApacheが応答が困難と判断した時に出すエラーなので単純な設定ミスでは無いように思われます。

  • t_ohta
  • ベストアンサー率38% (5076/13258)
回答No.2

VirtualHost の設定を DocumentRoot "/xampplite/htdocs/dummy" ServerName trunk.dummy.com として、hosts ファイルに 127.0.0.1 trunk.dummy.com と書き込めば、ブラウザに http://trunk.dummy.com とURLを指定してアクセスすることができます。

rynak_jp
質問者

補足

私もその方法で設定してますが、 503 エラーとなります。 その設定のまま、ServerName と hosts に dummyと変更して、 ドット無しにするとアクセスできます。不思議です。

  • t_ohta
  • ベストアンサー率38% (5076/13258)
回答No.1

どのディレクトリのデータを返すかは DocumentRoot "/xampplite/htdocs/dummy-host.localhost" で設定しています。 これを DocumentRoot "/xampplite/htdocs/dummy" とするだけです。

rynak_jp
質問者

補足

ディレクトリのデータを返すということではなく、以下のようにしたいと おもってるのですが、上手くいきません。 DocumentRoot "/xampplite/htdocs/dummy" http://trunk.dummy.com のように使えればと思ってます

関連するQ&A

  • バーチャルホスト設定

    何度も投稿して申し訳ありません(汗) ここしか聞くところがなくてorz バーチャルホストの設定ですが Apacheが正常にインストールをしていていると想定して vi /etc/httpd/conf/httpd.conf の下のところにあるバーチャルホストの設定のコメントを外すと 403となってApacheの画面が見れていた localhostも見えなくなってしまします。 何か間違いがあるのでしょうか?ちなみに外したのは #NameVirtualHost *:80 ↓ NameVirtualHost *:80 #<VirtualHost *:80> # ServerAdmin webmaster@”ドメイン名” # DocumentRoot /home/ftpmaster/localhost/”ドメイン名” # ServerName ”ドメイン名” # ErrorLog logs/error_log #</VirtualHost> ↓ <VirtualHost *:80> ServerAdmin webmaster@”ドメイン名” DocumentRoot /home/ftpmaster/localhost/”ドメイン名” ServerName ”ドメイン名” ErrorLog logs/error_log </VirtualHost> です。 他に設定などがあるようでしたらご指摘していただけると嬉しいです。 使用OS→CentOS5i386

  • バーチャルホストで、同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の教本の説明などで質問があります。

    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
  • apacheのバーチャルホストについて

    恐れ入ります。 linuxでサーバーの運営をしてみようかなと思っているのですが、windows xp proで試しにapacheを入れてみてドメインを2つ取得してhttpd.confのバーチャルホストについて記述してみました。 その際に以下をつけたして新しいドメインでブラウザからアクセスしてみたら普通にアクセスできました。どこかのサイトでDNSサーバーを自分のlinuxにたちあげないといけないみたいなことが書いてあったのですが、linuxの場合はdnsサーバーをたちあげないといけないのでしょうか?教えてください。 <VirtualHost xxx.xxx.x.xx> ServerAdmin xxx@xxx.com DocumentRoot "C:\Program Files\Apache Group\Apache2\aaa" ServerName 新しいドメイン ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>

  • ApacheでのVirtual Hostの設定

    RedHatLinux9.0/Apache2.0 動的IPのADSLでhn.orgのDDNSを使い、サーバを立てました。 ドメインを持っているため、それを割り当てようと/etc/httpd/conf/httpd.confでVirtual Hostの設定をしたのですが、外部からドメインで接続しても指定したディレクトリを読みに行ってくれず、ディフォルトの/var/www/htmlのディレクトリが表示されていまいます。 DNS(bind?)をこちらで動かしてないのですが、それが原因なのでしょうか? httpd.confはこのようにしています。 # # Use name-based virtual hosting. # NameVirtualHost 127.0.0.1 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # <VirtualHost 127.0.0.1> ServerAdmin admin@自分のドメイン.biz DocumentRoot /home/ff/www/ ServerName www.自分のドメイン.biz ServerAlias 自分のドメイン.biz ErrorLog logs/ff/error_log CustomLog logs/ff/access_log common </VirtualHost> また、NameVirtualHost 127.0.0.1と<VirtualHost 127.0.0.1>を、NameVirtualHost *と<VirtualHost *>に変えるとすべてのアクセスがForbiddenになってしまいます。 ログをみたところ、どういうわけかIE6.0なのにHTTP/1.0で繋がっているみたいなのですが、やはりそれなのでしょうか・・・? すみません。アドバイスよろしくお願いいたします。m(_ _)m

  • apache2.2でのバーチャルホストでの設定

    質問させて頂きます。 apache2.2.21にてweb鯖を立てて、ドメインを取得しDDNSにてテストしています。 test.comというドメインにバーチャルホストにて web1.test.comとweb2.test.comを設定 した場合に、 なぜかtest.comとweb1.test.comが同じ内容が表示されてしまいます。 web2は通常通り表示されます。 詳しい方が居ましたら間違い点を教えて下さい。 httpd-vhostsの内容 # # Virtual Hosts # # 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.2/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> DocumentRoot "C:/web/web1" ServerName web1.babayasu.info ErrorLog "logs/web1.localhost-error.log" CustomLog "logs/web1.localhost-access.log" common <Directory "C:/web/web1"> order deny,allow allow from ALL Options Indexes FollowSymLinks ExecCGI IncludesNoExec </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/web/web2" ServerName web2.babayasu.info ErrorLog "logs/web1.localhost-error.log" CustomLog "logs/web1.localhost-access.log" common <Directory "C:/web/web2"> order deny,allow allow from ALL </Directory> </VirtualHost>

  • /etc/httpd/conf/httpd.confの中身について

    失礼します。linux初心者です。 Apacheの仮想サイトの構成について調べたいのですが、 /etc/httpd/conf/httpd.confを参照したところ以下の様に記述されています。 <VirtualHost *:80> # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost> これは、 WEB接続使用ポート:80 サーバードメイン:webmaster@dummy-host.example.com ルートディレクトリ:/www/docs/dummy-host.example.com サーバー名:dummy-host.example.com ログ保存場所:dummy-host.example.com-error_log        logs/dummy-host.example.com-access_log common という解釈で間違いありませんでしょうか。 またこの仮想サイトのsmarty保存場所を調べるにはどのようにすればよいですか。

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

    http://test.com →/usr/local/apache/htdocs http://www.test.com →/usr/local/apache/htdocs http://user.test.com →/home/user/public_html としたいのですが、DNSの設定とhttpd.confの設定はどのようにしたらよいでしょうか? DNSはワイルドカード有効にしてあります。 <VirtualHost *:80> ServerAdmin webmaster@test.com DocumentRoot /usr/local/apache/htdocs Servername www.test.com ErrorLog logs/www.test.com-error_log CustomLog logs/www.test.com-error_log common </VirtualHost> <VirtualHost *:80> ServerAdmin user@test.com DocumentRoot /home/user/public_html Servername user.test.com ErrorLog logs/user.test.com-error_log CustomLog logs/user.test.com-error_log common </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@test.com DocumentRoot /usr/local/apache/htdocs Servername test.com ErrorLog logs/test.com-error_log CustomLog logs/test.com-error_log common </VirtualHost> このように設定したところ http://test.comでアクセスするとhttp://user.test.comと同じページが表示されてしまいます。

  • パーパーフェクト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のVirtualHostでの振り分けについて(SSL)

    VirtualHostを使って同一サーバーでのSSLの対応または非対応の振り分けをしています。 WinXP Apache 2.0.55 C:\Apache3 Tomcat 4.1 C:\Program Files\Apache Group\Tomcat 4.1 OpenSSL C:\OpenSSL apacheとtomcatは連携させています。 apache httpd.confの最後に以下を追加するとApacheが起動しません。 <VirtualHost localhost:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "C:/Apache3/htdocs"   SSLDisable # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> SSLDisableを削除すると、問題なく起動しますがhttp,httpsと両方でアクセス出来てしまいます。 何がいけないんでしょうか? 最終的には、デフォルトでSSL不可にしておいてVirtualHostで 指定したディレクトリにSSLを施したいです。