0

特定のポート番号を保護するために、htpasswd、またはある種の htaccess ルールを使用することは可能ですか。たとえば、ポート 5533 でデータベース プロファイラーを実行していて、パブリック アクセスを停止したいと考えています。

ありがとう

4

1 に答える 1

1

これを試して:

    RewriteCond %{SERVER_PORT} !5533 # If port is 5533
    RewriteRule ^ - [E=NO_AUTH:1] # We're setting the env variable for any request
                                  # because condition works only on next line

    Order deny,allow 
    Deny from all
    AuthType basic
    AuthName "You have to be logged in"
    AuthUserFile "/etc/httpd/conf.d/.htpasswd" #Your htpasswd path
    Require valid-user
    Allow from           env=NO_AUTH # If env variable was set
                                     # we can pass the request only through authentication
    Satisfy              Any
于 2013-01-02T11:32:35.830 に答える