Nginx-token Verification

Source: Internet
Author: User

What is token?

Security tokens

function:

Prevent robot Brush Requests

Effect:

No token connection is added to the IDC environment, directly to the 404 page


Token's flow in the HTTP protocol of Ngnix:


nginx module and configuration:Reverse proxy:

Location/{

Proxy_pass http://localhost:8000;

Proxy_set_header X-real-ip $remote _addr;

}

Load Balancing:

upstream.com {
Server 192.168.5.126:80;
Server 192.168.5.27:80;
}

server{
Listen;
server_name a.com;
Location /{
Proxy_pass http://a.com;
proxy_set_header Host $host;
proxy_set_header x-real-ip $remote _addr;
proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
       }
    }

Page buffering:

/usr/local/nginx/conf/proxy.conf

Proxy_redirect off;

Proxy_set_header Host $host;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Proxy_set_header accept-encoding ' gzip ';

Client_max_body_size 100m;

Client_body_buffer_size 256k;

Proxy_connect_timeout 60;

Proxy_send_timeout 60;

Proxy_read_timeout 60;

Proxy_buffer_size 512k;

Proxy_buffers 8 512k;

Proxy_busy_buffers_size 512k;

Proxy_temp_file_write_size 512k;


This configures dynamic files that cannot be cached, and HTML files can be cached

URL rewriting:

When accessing http://abc.test.com jump to http://www.test.com/test/abc/

rewrite command

server {
Listen 80;
server_name*.test.com;
if ($http _host ~* "^ (. *) \.test\.com$") {
Set $domain $;
Rewrite ^ (. *) http://www.test.com/test/$domain/break;
}
}



Nginx-token Verification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.