安裝nginx

nginx 不僅可以做反向代理,也可以做正向代理(代理上網)
http://nginx.org/en/download.html
./configure --prefix=/home/nginx --with-pcre --with-http_ssl_module(https)
配置https

nginx 阿里雲
    server {
    listen 6301;
    server_name xxxxxxx;
    ssl on;

    ssl_certificate   cert/xxxxxx.pem;
    ssl_certificate_key  cert/xxxxxx.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    location / {

                  root /home/nginx/xxx;
                  try_files $uri /index.html;
                  expires       max;

             }
        }

nginx.conf

#user  nobody;
worker_processes  8;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  /usr/local/ngin/logs/error.log  info;

pid        /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 65535;
events {
    worker_connections  65535;
}

http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    upstream tomcat {
         #ip_hash;
             server xxx:8200;
             server xxx:8201;
    }

    #gzip  on;

    server {
        listen       8180;
        server_name xxxxx;
        ssl on;

        ssl_certificate   /usr/local/nginx/cert/xxxx.pem;
        ssl_certificate_key /usr/local/nginx/cert/xxxxxx.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
            #charset koi8-r;

        #access_log  logs/host.access.log  main;
        location ^~ /txserver/ {
            proxy_pass http://tomcat;

        }
        location / {
             root /usr/local/nginx/xxx;
             try_files $uri /index.html;
              expires       max;

        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章