Apache2.2で直リンクの禁止

このQ&Aのポイント
  • Apache2.2で直リンクの禁止について質問があります。DocumentRootはvar/www/htmlです。userDirの直リンクやcgi-binの直リンクの禁止はうまくいったのですが、画像を格納しているディレクトリなどへの直リンク禁止がうまくいきません。
  • Apache2.2で直リンクの禁止について質問です。DocumentRootはvar/www/htmlで、userDirの直リンクやcgi-binの直リンクの禁止は問題なくできましたが、画像を格納しているディレクトリなどへの直リンク禁止が上手くいきません。
  • Apache2.2で直リンクの禁止について質問します。DocumentRootはvar/www/htmlで、userDirの直リンクやcgi-binの直リンクの禁止はうまくいきましたが、画像を格納しているディレクトリなどへの直リンク禁止ができません。
回答を見る
  • ベストアンサー

Apache2.2で直リンクの禁止

タイトルのままなんですが、直リンクを禁止にしたいです。 DocumentRootはvar/www/htmlです <Directory "/var/www/html/image/"> Order allow,deny Deny from all Allow from env=local_referal </Directory> userDirの直リンク(CGIとimage)、またDocumentRoot下のcgi-binの cgiへの直リンクの禁止はうまくいったんですが、 上記のように画像を格納しているような ディレクトリなどへの直リンク禁止がうまくいきません よろしくおねがいします。

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

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

いろいろな方法がありますが、その記述を引き続き生かすならば Allow from env=local_referal の行の前に SetEnvIf Referer "^http://www.example.com/" local_referal SetEnvIf Referer "^$" local_referal (http://www.example.com/ はご自身のサイトのURL) を加える必要があります。 設定例はそのまま http://httpd.apache.org/docs/2.0/ja/env.html の「画像の盗用を防ぐ」という項にて解説されていますので参考にしてみてください。

参考URL:
http://httpd.apache.org/docs/2.0/ja/env.html

関連するQ&A

  • CGIへの直リンク防止方法について

    CGIへの直リンクの防止方法について質問です. MacOS X でWEBサーバーを構築しています.httpdはapacheです. 現在,http://www.aaa.jp/bbb/ccc.htmlからhttp://www.aaa.jp/cgi-bin/ccc.cgiへリンクさせています.ccc.htmlへは.htaccessを用いてパスワードによるアクセス制限を行っております. 今の設定ですと,cgiファイルへ直接リンクできてしまいます.そこで,直接リンクを防止するために,apache内に <Directory /library/var/cgi-bin> SetEnvIf Referer "^http://www\.aaa\.jp/ ref_ok order deny,allow deny from all allow from env=ref_ok </Directory> という記述をしました.しかしこの記述を加えるとcgiを実行できなくなってしまいます.cgi-biフォルダ内の.htaccessを有効にして,.htaccessで記述してもうまくいきません. この記述はhttp://www.shtml.jp/htaccess/referer.htmlを参考にしました. どこがおかしいところはありますでしょうか. ご教授お願いします.

  • ApacheのScriptAliasについて

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/ ScriptAlias /cgi-bin/ /home/*/public_html/cgi-bin/ # # "/usr/lib/cgi-bin" could be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory /var/www/cgi-bin/> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> <Directory /home/*/public_html/cgi-bin> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> 何がやりたいかと言うと複数箇所でcgi-binを作ってCGIをうごかせるようにしたいのですが、ScriptAliasは複数指定ってできるのでしょうか? できなければ何かうまい方法はないでしょうか?よろしくお願いしますm(_ _)m

  • httpd.confを添削してください!!(長文)

    こんにちわ いろいろと調べながらhttpd.confを自分の理想の動作を得るたねに設定したつもりです。 添削をお願いします。 /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ DocumentRoot /var/www/html <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory "/var/www/html"> #←home Options FollowSymLinks Includes AllowOverride All Order allow,deny Allow from all </Directory> #.htaccessを許可、cgiは不可、ssiは許可、シンボリックリンク許可 Order~略 <IfModule mod_userdir.c> UserDir public_html </IfModule> <Directory /home/*/public_html> AllowOverride AuthConfig Limit Options +ExecCGI +Includes </Directory> #ユーザー領域では.htaccessで認証、アクセス元などで制御の許可。 それ以外は不可。 homeでcgiが不可ですがここでは許可したいので+を付けた。 <Directory "/var/www/cgi-bin"> AllowOverride All Options ExecCGI Order allow,deny Allow from all AddHandler image .gif .jpg AddHandler text/html .htm .html </Directory> /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ こんな感じなんですがどこかおかしいでしょうか?

  • apache:特定のディレクトリのみSSLでしか接続できないようにするにはどうしたらよいでしょうか。

    RHL9.0でapache2.0(rpmでインストール)です。/var/www/html以下はhttpでもhttpsでも接続できるようにして/var/www/cgi-binはhttpsでしか接続できないようにできますか。その場合、http.confにはどのように記述したらよいのでしょうか。現在httpsで接続できるのですが、http.confにmod_sslに関する部分がありませんでした。Open-SSLはインストールされています。cgi-binは以下の設定となっています。 <Directory "/var/www/cgi-bin"> AllowOverride None Options None Order deny,allow Deny from all Allow from aaa.bbb. </Directory>

  • apacheのScriptAliasの記述について

    どなたか,ご教授いただければ幸いです。 WindowsXp Proでapacheを動かしています。次の設定で,cgiはうまく動作していました。 --- <IfModule alias_module> ScriptAlias /cgi-bin/ \"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/\" </IfModule> <Directory \"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin\"> AllowOverride None Options ExecCGI Order allow,deny Allow from all AddHandler image/gif .gif AddHandler image/jpeg .jpg </Directory> --- これに, http://www.miloweb.net/win/server/apache.html を参考にして,各ユーザーフォルダでcgiが実行できるようにしようと,次のようにしました。 --- <IfModule alias_module> ScriptAlias /cgi-bin/ \"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/\" ScriptAlias /cgi/ \"C:/www/users/*/cgi/\" </IfModule> <Directory \"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin\"> AllowOverride None Options ExecCGI Order allow,deny Allow from all AddHandler image/gif .gif AddHandler image/jpeg .jpg </Directory> <IfModule mod_userdir.c> UserDir \"C:/www/users/*/\" </IfModule> <Directory \"C:/www/users/*/cgi/\"> AllowOverride None Options ExecCGI Order allow,deny Allow from all AddHandler image/gif .gif AddHandler image/jpeg .jp </Directory> --- その結果, http://localhost/~user/ としてuserのホームページにアクセスできるようになったのですが, cgiについては, http://localhost/~user/cgi/・・・ としてもアクセスできません。どなたか原因をご教授いただけないでしょうか。 ScriptAlias /cgi-bin/ \"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/\" ScriptAlias /cgi/ \"C:/www/users/*/cgi/\" の行を入れ替えると,\"C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/\"においてあるcgiが実行できなくなります。ScriptAliasは1行目しか有効でないようにも見えるのですが,上に書いた参考URLではできているようなので,戸惑っています。

  • apacheとCGIの設定(httpd.conf)について

    Apache/1.3.26を使用しています。 CGIの定義の中に Alias /cgi-bin/ /usr/lib/cgi-bin <Directory /usr/lib/cgi-bin/> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> があるのですがこれは何を定義しているのでしょうか? また、ある指定のフォルダ /var/www/cgi-bin だけ CGI設置可能にするにはどうすればよいでしょうか?

  • 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/"をコメントアウトしました。もしよろしければご指導のほどよろしくおねがいします。

  • apache2.2の設定について

    あるディレクトリでsite_available中のファイルの設定が <Directory /var/hogehoge> Options ExecCGI -FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory> となっているのですが、現在このhogehoge中のディレクトリでimageというディレクトリに置かれたgifファイル(すなわちvar/hogehoge/image/○○○.gif)をcgiとして認識されています。 これを回避するためにimage以下の場合はcgiではなくgifで認識させるようにしたいのですが、どうすればよいのでしょうか? apacheはdebian系のapache2.2系です。 宜しくお願い致します。

  • 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>

  • /cgi-bin/のファイル読み出し

    WindowsXPでApacheをlocalhostで使用しています。 httpd.confを以下のように設定してcgiは問題なく作動していますが、/cgi-bin/に置いた画像やhtmlが読み出せません (すなわちhttp://localhost/cgi-bin/にアクセス出来ず、Forbiddenのエラーが出ます) 今は仕方なく、cgiで使用するファイルや画像をDocumentRoot配下に置いていますが、/cgi-bin/配下のファイルを読み出すhttpd.confの設定を教えて下さい。 DocumentRoot "F:/" <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "F:/"> AllowOverride None Order allow,deny Allow from all </Directory> <IfModule mod_alias.c> ScriptAlias /cgi-bin/ "F:/cgi-bin/" <Directory "F:/cgi-bin"> AllowOverride None Options ExecCGI MultiViews Order allow,deny Allow from all </Directory> </IfModule>