httpd-vhosts.confの設定について教えてください
<VirtualHost *:80> ServerAdmin www.???.tk DocumentRoot "/opt/lampp/hdocs/laravel/public" ServerName www.???.tk ServerAlias www.???.tk 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 "/opt/lampp/docs/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> <VirtualHost *:80> </VirtualHost> が2つあるのが疑問ということと、 最初の指定で、間違っている箇所は、ございませんでしょうか。 DNSのアドレスは、2桁が4つならんでます。この入力をしなくても 良いのでしょうか。 <VirtualHost *:80.80.80.80> ServerAdmin www.???.tk DocumentRoot "/opt/lampp/hdocs/laravel/public" ServerName www.???.tk ServerAlias www.???.tk ErrorLog "logs/dummy-host.example.com-error_log" CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost> <VirtualHost *:80.80.81.81> ServerAdmin www.???.tk DocumentRoot "/opt/lampp/hdocs/laravel/public" ServerName www.???.tk ErrorLog "logs/dummy-host2.example.com-error_log" CustomLog "logs/dummy-host2.example.com-access_log" common </VirtualHost> で、変更しました。 しかし、ローカル localhost/laravel/publicにアクセスすると You don't have permission to access the requested object. It is either read-protected or not readable by the server. のエラーです。
質問内容が、少し情報不足のように思います。Apacheのページに(内容が正確とは限りませんが・・)設定サンプルがありますので、これを参考に、どのような使い方をされるのか追記された方がよいかと思います。https://httpd.apache.org/docs/2.4/vhosts/examples.html
必要な情報は、先ほどの設定例でいうと「一つの IP アドレスでいくつかの名前ベースの ウェブサイトを実行する」、「複数の IP アドレスのあるホストで名前ベースの ホスティングを行なう」など、どれを想定しているか、ということです。これによって設定内容が変わります。また、VirtualHost の後に続くのは、ホスト名:ポート番号 です。
アクセス不可の方は、`ls -l localhost/laravel/public`の結果が必要です。そのフォルダに、httpdがアクセスできないのでは?
ドメイン www.???は、一つです。DNSアドレスというのでしょうか。それは、2つあり、2桁.2桁.2桁.2桁.というものです。
-rw-r--r-- 1 tide tide   4081 11月 24 11:19 a.css -rw-r--r-- 1 tide tide   4081 11月 24 11:18 a.css~ -rw-r--r-- 1 tide tide   8769 11月 22 23:37 a.php -rw-r--r-- 1 tide tide  90117 11月 19 01:27 area.jpg -rw-r--r-- 1 tide tide  14471 10月 29 07:56 cola.jpg -rw-r--r-- 1 tide tide   9476 11月 16 23:02 est.jpg -rw-r--r-- 1 tide tide    621  5月  3  2013 facebook.png -rw-rw-r-- 1 tide tide      0  4月 27  2016 favicon.ico -rw-r--r-- 1 tide tide   8674 11月 24 10:25 index.html -rw-rw-r-- 1 tide tide   1786  4月 27  2016 index.php -rw-r--r-- 1 tide tide 716435 11月 16 22:49 mini_social_icons_v2.3.3.zip -rw-r--r-- 1 tide tide   5845 11月 18 10:18 oukan.png -rw-rw-r-- 1 tide tide     24  4月 27  2016 robots.txt -rw-r--r-- 1 tide tide  59076 11月 19 01:25 unnamed.webp -rw-rw-r-- 1 tide tide    914  4月 27  2016 web.config
その場合、2つのIPアドレス(例:80.80.80.80と80.80.81.81) の片方だけをWeb用に使えばよいのではないでしょうか?
`ls -l`は、publicフォルダのユーザが、Apacheの実行ユーザーと一致している(または必要な権限がある)かを確認したかったのですが・・ 参考:http://egapool.hatenablog.com/entry/2013/11/29/184300
ありがとうございます。そういうことですね。
これで、publicにアクセスできないということは、けんげんがひつようということでしょうか。
そうなります。publicのアクセス権を変更するか、Apacheの設定(実行グループ・ユーザ)を変更するかのどちらかになると思います。
ありがとうございます。一旦閉じます。
回答1件
あなたの回答
tips
プレビュー