In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Detailed explanation of Nginx hotlink protection and Nginx access control and Nginx parsing php configuration
Nginx hotlink protection
The configuration is as follows, which can be combined with the above configuration
Location ~ * ^. +\. (gif | jpg | png | swf | flv | rar | doc | pdf | gz | bz2 | jpeg | bmp | xls) ${expires 7d; valid_referers none blocked server_names *. Test.com; if ($invalid_referer) {return 403;} access_log off;}
Nginx access control
Requirements: requests to access the / admin/ directory, allowing only a few IP access.
The configuration is as follows:
Location / admin/ {allow 192.168.133.1; allow 127.0.0.1; deny all;}
Create a test
Mkdir / data/wwwroot/test.com/admin/echo "test,test" > / data/wwwroot/test.com/admin/1.html
Detect restart
/ usr/local/nginx/bin/nginx-t & &-s reload
test
Curl-x127.0.0.1 curl 80 test.com/admin/1.html-I curl-x 192.168.133.130 curl 80 test.com/admin/1.html-I
Nginx access control
The configuration is as follows:
Location ~. * (abc | image) /. *\ .php ${deny all;}
According to the user_agent limit
If ($http_user_agent ~ 'Spider/3.0 | YoudaoBot | Tomato') {return 403;}
Deny all has the same effect as return 403.
Nginx parses the configuration of php
The configuration is as follows:
Location ~\ .php$ {include fastcgi_params; fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / data/wwwroot/test.com$fastcgi_script_name;}
Fastcgi_pass is used to specify the address or socket for php-fpm listening.
The above is the explanation of Nginx hotlink protection and Nginx access control and Nginx parsing php configuration, if you have any questions, please leave a message or go to the community to exchange and discuss, thank you for reading, hope to help you, thank you for your support!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.