Nginx Reverse Proxy HTTPS site

Source: Internet
Author: User
Tags nginx reverse proxy

The basic proxy configuration is not said now post configuration and highlight a few error-prone issues.



User Nginx;

Worker_processes 1;

Error_log/var/log/nginx/error.log;

Pid/var/run/nginx.pid;

Events {

Worker_connections 1024;

}

HTTP {

Include/etc/nginx/mime.types;

Default_type Application/octet-stream;

Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '

' $status $body _bytes_sent ' $http _referer '

' "$http _user_agent" "$http _x_forwarded_for";

Access_log/var/log/nginx/access.log main;

Sendfile on;

Keepalive_timeout 65;



server {

Listen 80;

server_name aaa.test.com;

Rewrite ^ (. *) https://$server _name$1 permanent;

} # #这一块用来指定rewrite


server {

Listen 443;

server_name aaa.test.com; # #如果后端是多vhost的server此处必须用真实域名.

Location/{

Proxy_pass https://172.16.160.131; # #realserver真实地址或域名

Proxy_set_header Host $host;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Client_max_body_size 100m;

Client_body_buffer_size 128k;

Proxy_connect_timeout 300;

Proxy_send_timeout 300;

Proxy_read_timeout 300;

Proxy_buffer_size 4k;

Proxy_buffers 4 32k;

Proxy_busy_buffers_size 64k;

Proxy_temp_file_write_size 64k;

Add_header x-frame-options Sameorigin;

}


SSL on;

SSL_CERTIFICATE/ETC/NGINX/CERT/SERVER.CRT; # #此处是realserver的站点证书, returning with self-signed is self-signed.

Ssl_certificate_key/etc/nginx/cert/server.key;

Ssl_session_timeout 5m;

Ssl_protocols SSLv3 TLSv1;

Ssl_ciphers all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp;

Ssl_prefer_server_ciphers on;

Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}

}





include/etc/nginx/conf.d/*.conf;


}


Nginx Reverse Proxy HTTPS site

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.