- ベストアンサー
サブディレクトリーの設定について
- サブディレクトリーの設定方法と注意点
- ApacheのVirtualHostを使用してサブディレクトリーを作成する手順
- サブディレクトリーの設定例と設定ファイルの詳細
- みんなの回答 (7)
- 専門家の回答
関連するQ&A
- 000-default.conf の説明。
000-default.conf について。 下記の様にして教えてくれませんか? 記 # However, you must set it for any further virtual host explicitly. ServerName www.xxxxxxxxxx.com ServerAdmin hop7799@xxx.xxxx.xx <VirtualHost *:80> DocumentRoot /var/www/html DocumentRoot /var/www/html/mysite1 DocumentRoot /var/www/html/mysite2 ErroLog ${APACHE_LOG_DIR}/error.log CustomLog ${SPACE_LOG_DIR}/access.log combined </VirtualHost > # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg 宜しくお願い申し上げます。
- ベストアンサー
- ハードウェア・サーバー
- 2つ目のウェブサイトの設定について。
1つ目のウェブサイトは構築できました。 000-default.confは下記の状態です。 記 <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName www.xxxxxxxxxx.com ServerAdmin hop7799@xxx.xxxx.xx DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 以上です。 しつこいようですけど、2つ目のウェブサイトの設定について 教えて下さい。 宜しくお願い申し上げます。 幸い、ココに初期状態を書いていますから、検索して 一人で2つ目のウェブサイトにチャレンジ致します。 VirtualHostは分厚い参考書にも載っていません。 おやすみなさい。ボクは起きています。
- ベストアンサー
- ハードウェア・サーバー
- 000-default.confの設定方法。
いつもお世話になり、誠にありがとうございます。 標記の件。 mysite1,mysite2にコンテンツが入っております。 どうすれば表示するでしょうか? ご多忙中申し訳ありません。 ご回答のほど、宜しくお願い申し上げます。 記 # However, you must set it for any further virtual host explicitly. ServerName www.xxxxxxxxxx.com ServerAdmin hop7799@xxx.xxxx.xx <VirtualHost *:80> DocumentRoot /var/www/html DocumentRoot /var/www/html/mysite1 DocumentRoot /var/www/html/mysite2 ErroLog ${APACHE_LOG_DIR}/error.log CustomLog ${SPACE_LOG_DIR}/access.log combined </VirtualHost > # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. 以上
- ベストアンサー
- ハードウェア・サーバー
- パーパーフェクト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(2.0.63)(name basedなvirtual host)で、<想定していないサブドメ>.example.com に対してそれ専用の設定を。
Apache(2.0.63)で、name basedなvirtual hostをおこなっているのですが、example.com www.example.com develop.example.com の場合は、 それぞれのvirtual hostごとの設定(DocumentRoot など)がよまれ、【<想定していないサブドメ>.example.com】 の場合は、その場合特有の設定(DocumentRoot など)が読まれるようにしたいのですが、どうすればいいのでしょうか? <VirtualHost _default_:*>ほげほげ</VirtualHost>はIPベースのときにしか意味ないようですし・・・ なお。以下のように、ServerName をかかなければいい、というのをどこかでみかけ、実践したのですが、挙動変わらずです。 <VirtualHost *:80> # ServerName wildcard.example.com DocumentRoot /var/www/wildcard.example.com/htdocs </VirtualHost> DNSのほうは、 www 111.111.11.111 @ (None) 111.111.11.111 * (All Others) 111.111.11.111 develope 111.111.11.111 また、httpd.conf のほうは、 NameVirtualHost *:80 をちゃんと書いています。
- ベストアンサー
- Linux系OS
- 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での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
- ベストアンサー
- その他(インターネット接続・通信)
- Apache VirtualHost でワイルドカード(?)設定
Apache2.2.3を利用しています。 virtualhost.confに50程度のサブドメインを、 下記のように設定をしています。 *************************************************** <VirtualHost *:80> ServerName suzuki.example.com DocumentRoot /var/www/html/suzuki/ </VirtualHost> <VirtualHost *:80> ServerName sato.example.com DocumentRoot /var/www/html/sato/ </VirtualHost> <VirtualHost *:80> ServerName yamada.example.com DocumentRoot /var/www/html/yamada/ </VirtualHost> ・ ・ ・ *************************************************** つまり *************************************************** <VirtualHost *:80> ServerName ▲▲▲.example.com DocumentRoot /var/www/html/▲▲▲/ </VirtualHost> *************************************************** のようなルールになっているのですが、 これをワイルドカード使ってできないでしょうか? 宜しくお願いします!
- 締切済み
- その他(ITシステム運用・管理)
- 1つのIPアドレスでサブドメインをSSLにするには
1つのIPアドレスでサブドメインをSSL通信にしたいと思います。 https://www.hoge.com https://geho.hoge.com しかしIPはひとつです。 その場合ジオトラストでワイルドカード証明書(サブドメインなら 無制限に増やせる)を取得して設定をしてみましたが設定がうまく行き ません。 流れとしてcentos5でhttpd.confにVirtualHostを設定しました。 こんな感じです。 <VirtualHost *:80> ServerAdmin admin@hoge.com DocumentRoot /var/www/www.hoge.com ServerName www.hoge.com ErrorLog /var/log/www.hoge.com.err CustomLog /var/log/www.hoge.com.log combined </VirtualHost> CSRを作成して認証してもらいssl.confの設定しました。 # General setup for the virtual host <VirtualHost *:443> DocumentRoot "/var/www/www.hoge.com" ServerName www.hoge.com:443 鍵も下記のように変更しました。 SSLCertificateFile /usr/local/certs/server.crt SSLCertificateKeyFile /usr/local/certs/server.key それでもなぜかドメインは一つかしか使えず、さらにhttpsで アクセスするとIEでは 「このページにはセキュリティで保護されている項目と保護されて いない項目が含まれます」 とエラーがでます。 サイトはPHPで構築したものですが小規模なサイトです。 非常に困っておりSSL通信をVirtualHost毎に行いたいと思います。 どうすれば良いかまったくわからない状態です。 アドバイスのほどよろしくお願いします。
- 締切済み
- Linux系OS
- バーチャルホスト設定
何度も投稿して申し訳ありません(汗) ここしか聞くところがなくて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
- ベストアンサー
- Linux系OS
お礼
コンフィグファイル=confファイルですか? わかりました。 ありがとうございます。