ディレクトリに対するNginx IPの制限

  

nginx phpmyadminイントラネットIPユーザーのために開き、外部ネットワークIPユーザーは閉じます(以前の設定ではlocation〜^ /directory /use regular、優先順位はlocation /configurationよりも高く、そのため、nginxはホームページを解析できません。
コードは次のとおりです。

server {

listen 80;

server_name example.com;

access_log logs /access.logメイン;

location /{

root html;

index index.php index.html index.htm;

}

場所〜^ /phpmyadmin /{

許可192.168.1.0/24;

すべて拒否;

場所〜。*。 Php5)?$ {

root /var /mailapp /nginx /html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_paramsを含める;

}

}

location〜。*。 Php5)?$ {

root /opt /nginx /html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include Fastcgi_params;

}

}

このコードを次のように設定することもできます。server {listen 80; server_name example.com; access_log logs /access.log main; Location /{ルートHTML;インデックスindex.php index.html index.htm;} location〜^ /download /{許可192.168.1.0 /24;すべて拒否;インデックスindex.php index.do index.html index.htm; location 〜。*。(php | (php5)?$ {root /var /mailapp /nginx /html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_paramsを含める}} location〜。*(php | int型 Php5)?$ {root /opt /nginx /html; astcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_paramsを含める}

Copyright © Windowsの知識 All Rights Reserved