Nginx Reverse proxy + load balancer simple Implementation (HTTPS mode)

Source: Internet
Author: User

Background:
A server (192.168.1.8) as an Nginx proxy server
b Server (192.168.1.150) as back-end real server

You now need to access the https://testwww.huanqiu.com request When you reverse proxy from the a server to the B server

This involves the configuration of the Nginx reverse proxy HTTPS request ~ ~ ~

------------------------------------------------------------------------------------
Operation Flow on a server (192.168.1.8):

1) Compile and install Nginx
[email protected] ~]# Yum install-y pcre pcre-devel OpenSSL openssl-devel gcc
[Email protected] ~]# CD/USR/LOCA/SRC
[Email protected] ~]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[Email protected] ~]# TAR-ZXVF nginx-1.8.0.tar.gz
[Email protected] ~]# CD nginx-1.8.0
#添加www用户 where the-m parameter indicates that the user home directory is not added, and the-s parameter indicates the specified shell type

[[Email protected] ~] #useradd www-m-s/sbin/nologin
[Email protected] ~]# #vim AUTO/CC/GCC
#将这句注释掉 Cancel Debug compilation mode about 179 lines
#CFLAGS = "$CFLAGS-G"

#我们再配置下nginx编译参数, be sure to add--with-http_ssl_module at compile time, in order to let Nginx support SSL function!
[Email protected] ~]#/configure--prefix=/usr/local/nginx--user=www--group=www--with-http_stub_status_module-- With-http_ssl_module
[[Email protected] ~] #make
[[Email protected] ~] #make Install clean

2) Configure Nginx
[Email protected] ~]# cd/usr/local/nginx/conf
[Email protected] conf]# vim nginx.conf

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 user  nobody;worker_processes  8;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;events {    worker_connections  65535;}   http {    include       mime.types;    default_type  application/octet-stream;    charset utf-8;     log_format  main  ‘$http_x_forwarded_for $remote_addr $remote_user [$time_local] "$request" ‘                      ‘$status $body_bytes_sent "$http_referer" ‘                      ‘"$http_user_agent" "$http_cookie" $host $request_time‘;    sendfile       on;    tcp_nopush     on;    tcp_nodelay    on;    keepalive_timeout  65;      fastcgi_connect_timeout 3000;    fastcgi_send_timeout 3000;    fastcgi_read_timeout 3000;    fastcgi_buffer_size 256k;    fastcgi_buffers 8 256k;    fastcgi_busy_buffers_size 256k;    fastcgi_temp_file_write_size 256k;    fastcgi_intercept_errors on;           client_header_timeout 600s;    client_body_timeout 600s;      client_max_body_size 100m;         client_body_buffer_size 256k;   <br>          ## support more than 15 test environments<br>    server_names_hash_max_size 512;<br>    server_names_hash_bucket_size 128;<br>    gzip on;    gzip_min_length  1k;    gzip_buffers     4 16k;    gzip_http_version 1.1;    gzip_comp_level 9;    gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php;    gzip_vary on;        include vhosts/*.conf;}

Nginx Reverse proxy + load balancer simple Implementation (HTTPS mode)

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.