Nginx reverse Proxy and authentication reverse proxy

Source: Internet
Author: User
Tags nginx reverse proxy

Certified Reverse Proxy

Server

{

Listen 443 SSL;

SSL on;

SSL_CERTIFICATE/USR/LOCAL/NGINX/SSL/CN.CRT;

Ssl_certificate_key/usr/local/nginx/ssl/cn.key;


server_name www.aa.com;

Location/{

# 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;

Include proxy_setting.conf;

# Proxy_next_upstream Error timeout Invalid_header http_500 http_502 http_503;

#

# # # # Set Headers # # #

# Proxy_set_header Host $host;

# Proxy_set_header X-real-ip $remote _addr;

# Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

#

# # # Most PHP, Python, Rails, Java apps can use this header # # #

# Proxy_set_header X-forwarded-proto HTTPS;

#

# # # By default we don ' t want to redirect it # # # #

# proxy_redirect off;

Proxy_pass HTTPS://SSL1;

}

}

proxy_setting.conf Content


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_cache_use_stale timeout http_502 http_504;

Proxy_cache_use_stale updating error timeout;

Proxy_set_header X-forwarded-proto HTTPS;

Proxy_ignore_headers x-accel-expires Expires Cache-control Set-cookie;

Add_header X-cache ' $upstream _cache_status from $server _addr ';

Proxy_max_temp_file_size 0;

Proxy_connect_timeout 5;

Proxy_send_timeout 5;

Proxy_read_timeout 3;

Proxy_buffer_size 4k;

Proxy_buffers 4 32k;

Proxy_busy_buffers_size 64k;

Proxy_temp_file_write_size 64k;


Reverse Proxy


~

Server

{

Listen 80;

server_name api.aaa.com;


Location/{

# 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;

Include proxy_setting.conf;

Proxy_pass Http://online;

}

Access_log/data/wwwlogs/api.log access;


}

The main difference is bold font other uses proxy_setting.conf file can be

This article is from the "Learn Linux" blog, so be sure to keep this source http://10265013.blog.51cto.com/10255013/1834912

Nginx reverse Proxy and authentication reverse proxy

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.