• ベストアンサー

Apache2の設定について。

Solaris10にてApache2.0.52使っていて、ユーザルート上でCGIの許可をしているのにユーザルート上のCGIにアクセスしようとすると403エラーが発生してしまいます。 CGI-BIN以外の場所でCGIを使おうとする場合はエイリアスも設定しないといけないのでしょうか? 下に設定箇所も載せておきますので、確認よろしくおねがいします。 # Control access to UserDir directories. The following is an example # for a site where these directories are restricted to read-only. <Directory /export/home/*/public_html> AllowOverride None Options IncludesNoExec ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order deny,allow Allow from 192.168.80.0/24 Deny from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>

  • yui_o
  • お礼率37% (3/8)

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

  • ベストアンサー
  • entree
  • ベストアンサー率55% (405/735)
回答No.3

Apache で CGI を動作させる方法は、mod_cgi (MPM が worker の場合は mod_cgid) を有効にした上で以下の2通りのどちらかの設定を行う必要があります。 1. ScriptAlias を設定する。 (ex.) ScriptAlias /cgi-bin/ /opt/httpd/share/cgi-bin/ 2. Options ExecCGI と AddHander を設定する (ex.) Options ExecCGI AddHander cgi-script .cgi .pl ...... あと、Solaris 10 は触ったことがないので分かりませんが、よくあるパターンとして、ホームディレクトリのパーミッションが 700 などになっていて、httpd デーモン (デフォルトでは nobody ユーザ) がアクセスできるようになっていない場合があります。root から su - nobody とやって、シェル上から CGI スクリプトが実行できるかどうか試してみてください。

その他の回答 (2)

回答No.2

AddHandler cgi-script .cgi を書いてないとか?

yui_o
質問者

補足

AddHandler cgi-script .cgi .pl と記述してあります;;

  • Bonjin
  • ベストアンサー率43% (418/971)
回答No.1

ファイルのパーミッションは確認しましたか?

yui_o
質問者

補足

ユーザディレクトリ、cgiともに755に設定してあります・・・

関連するQ&A

  • Fedora Apache ユーザディレクトリの設定 /をつけないと表示されない!

    Fedora CoreのApacheでユーザディレクトリのコンテンツを公開するため、下記のように設定しました。 <IfModule mod_userdir.c> UserDir public_html </IfModule> <Directory /home/*/public_html> AllowOverride All Options IncludesNoExec ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> で、ばっちり見れるようになったんですが、下記のような問題が残っています。 http://ホストアドレス/~ユーザ名/ では正常に表示されるが、 http://ホストアドレス/~ユーザ名 のようにスラッシュを省略すると、表示されない。 ご存知の方おられましたらよろしくお願いしますー!

  • apacheのユーザーディレクトリの設定

    Fedora Core6のapacheのユーザーディレクトリの設定で悩んでいます。 設定ファイル(httpd.conf)には以下のように記述しています。 #UserDir disable UserDir public_html <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> ユーザー登録をして/home/ユーザ名/にpublic_htmlフォルダを作成して、index.htmlページを作り、http://localhost/~ユーザー名/index.htmlにアクセスしましたが、「403 Forbidden」となってしまいます。 http://127.0.0.1/~ユーザー名/でアクセスしても「403 Forbidden」になります。 フォルダやファイルのパーミッションをいろいろと変えてみましたが表示されません。 こちらはLinux勉強中の初心者です。 よろしくお願いします。

  • Redhat9のHTTPDでCGIがつかえない

    まずやりたい事はユーザーごとにWEBができるようにして、CGIをpublic_html以下のどこにでもCGIが使えるようにしたい思っています。 いろんなサイトを見てhttpd.confをいじってますが、どうしてもCGIを実行しても500エラーがでます。perlの場所はあっているんですが。 httpd.confのいじった所は、 <IfModule mod_userdir.c> UserDir public_html </IfModule> と <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options IncludesNoExec ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> と ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"をコメントアウトしました。もしよろしければご指導のほどよろしくおねがいします。

  • Apacheの.htaccessにおけるルート

    apacheの学習中です。 Apacheで、ユーザーディレクトリを有効にしました。 ユーザーディレクトリ内で、 <a href="/">トップページへ</a> とすると、きちんと各ユーザーディレクトリのトップページへいくことを確認しました。 しかし、.htaccess内で ErrorDocument 404 /error/file_not_found.html とし、エラードキュメントを変更しようとすると、エラーページが正しく表示されませんでした。ログを見ると、以下のようになっていました。 File does not exist: /var/www/error/file_not_found.html どうやら、htaccessにおいてのルートディレクトリ指定が、各ユーザー個別のルートディレクトリになっていないようです。htaccessの/を各ユーザーのルートディレクトリに指定するには、どのように設定すればよいでしょうか? 現在、ユーザーディレクトリは以下のように設定しています。すいません。学習中なので、設定におかしなところがあるかもしれません。 <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Indexes Limit Options MultiViews FollowSymLinks IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> 原因が分かる方がいらっしゃれば、ご指摘くださると嬉しいです。 よろしくお願いいたします。

  • Apach2.0 ホームディレクトリでCGIが

    こんにちは。 CGIの勉強をしています。 わかる方がいらっしゃいましたら、おしえてください。 ソースは、poderosaでつないでviにて作成。 ブラウザからのアクセス http://XXX.XXX.XXX.XXX/~admin/cgi-bin/test.cgi (test.cgi)755 #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello\n"; ./test.cgi にて、Helloと表示される (httpd.confに追加したもの) UserDir public_html <Directory /home/*/public_html> AllowOverride All Options IncludesNoExec ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> 以下を追加したこともあり↓ <Directory /home/*/public_html/cgi-bin/> AllowOverride None Options ExecCGI SetHandler cgi-script Order allow,deny Allow from all AddHandler cgi-script .cgi </Directory> よろしくおねがいします。

  • Apacheでのユーザーディレクトリ生成

    現在fedora core4 -Apache- でサーバー構築を勉強中なのですが、どうしても解決できない問題が出ました。それはユーザーディレクトリを生成した後、そのディレクトリにアクセスできないという問題です。 ユーザー[testuser]を追加し、/home/testuser/public_htmlを作成後 /home/testuser/public_html/index.htmlを作成、 httpd.confの設定を <IfModule mod_userdir.c> #UserDir disable UserDir /home/*/public_html/ </IfModule> # # Control access to UserDir directories. The following is an example # for a site where these directories are restricted to read-only. # #<Directory /home/*/public_html> # AllowOverride FileInfo AuthConfig Limit # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Directory /home/*/public_html> AllowOverride All Options IncludesNoExec ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> とし、ttp://www.testsrv.net/~testuserにアクセスしたところ、 You don't have permission to access /~user1 on this server. アクセス権が無いとはじかれました。 この場合、アクセスできるようにするにはどのようにすれば良いのでしょうか?

  • .httpd.confの記述方法

    いつもお世話になります。 <!--#exec cmd="TEST.CGI"-->が使用できないため、httpd.confを 見直していたところ下記記述になっておりました。 371行目にOptions All、372行目にOptions Indexes MultiViews SymLinksIfOwnerMatchの記述があります。 2行続けてOptionsの記述がある場合動作はどうなるのでしょうか? どちらか削除した方がよろしいですよね。 お恥ずかしいのですが、ご回答お願いいたします。 -------------------------------------------- #<Directory /home/*/www> 357 # AllowOverride FileInfo AuthConfig Limit 358 # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 359 # <Limit GET POST OPTIONS PROPFIND> 360 # Order allow,deny 361 # Allow from all 362 # </Limit> 363 # <LimitExcept GET POST OPTIONS PROPFIND> 364 # Order deny,allow 365 # Deny from all 366 # </LimitExcept> 367 #</Directory> 368 369 <Directory /home/*/www> 370 AllowOverride All 371 Options All 372 Options Indexes MultiViews SymLinksIfOwnerMatch ExecCGI Includes 373 </Directory>

  • Fedora Core1サーバーでCGIが利用できません

    Fedora Core1でwebサーバーを立てたのですが、実行しようとすると「500 Internal Server Error」となってCGIが動きません。 perlへのパスやパーミッションの設定も見直しましたが、どこの設定が間違っているか分からないので、設定方法を教えてもらえないでしょうか? 現在の環境は ホスト名:saba.dyndns.org perlのパス:/usr/local/bin/perl CGIを仕えるようにしたいユーザー:guest CGIを設置するディレクトリ:/home/guest/cgi-bin/ Apacheのバージョンは2.0.49 となっています。 また以下はhttpd.confの抜粋です。 Listen *:80 #ScriptAlias /cgi-bin/ "/var/www/html/" ScriptAlias /cgi-bin/ "/home/guest/public_html/cgi-bin/" AddHandler cgi-script .cgi .pl <Directory "/home/guest/public_html/"> Options ExecCGI AllowOverride None Allow from all Order allow,deny </Directory> <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options Includes ExecCGI FollowSymLinks <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> 長文失礼しました。

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

    現在、メインのサーバhoge.ddo.jpにてApache2によるWebサーバを構築しています。 今回要望があり、ユーザのHPを別のドメインabc.dip.jpにバーチャルホストを利用して運営することになりました。 そこで質問なのですが、 http://abc.dip.jp/ にアクセスすることでユーザのHPにアクセスできます。しかし、 http://hoge.ddo.jp/~misa/ (misaはabc.dip.jpのHPを利用するユーザ) にアクセスしても同じ結果が得られてしまいます。 これを、 http://hoge.ddo.jp/~misa/ でアクセスした場合には、HPを表示できなくしたいのですが、このように設定することはできるのでしょうか? よろしくお願いします。 設定( /usr/local/etc/apache2/httpd.conf ) DocumentRoot "/usr/local/www/data" ServerName hoge.ddo.jp:80 <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec ExecCGI <Limit GET POST OPTIONS PROPFIND> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS PROPFIND> Order deny,allow Deny from all </LimitExcept> </Directory> NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /usr/local/www/data ServerName hoge.ddo.jp </VirtualHost> <VirtualHost *:80> DocumentRoot /home/misa/public_html ServerName abc.dip.jp </VirtualHost> 環境 FreeBSD 5.4-Release-p2 Apache 2.0.54

  • apacheの設定(IPアドレスによるアクセス制限の方法)

    下記のようなエラーがでてしまいます。 解決策をご存知の方、どうぞ教えてください。 よろしくお願いいたします。 ●エラー内容 error: couldn't perform authentication. AuthType not set!: /・・・ ●httpsd.confの内容(一部) <directory "/home/・・・"> <Limit POST GET> order deny,allow deny from all allow from XXX.XXX.XXX.XXX Require valid-user </Limit> options FollowSymLinks ExecCGI </directory> ●OS情報 Linux XXX 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown