码迷,mamicode.com
首页 > 其他好文 > 详细

安装nginx

时间:2018-11-13 23:59:31      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:nec   limit   logs   tom   tcp   connect   char   use   RKE   

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

}

安装nginx

标签:nec   limit   logs   tom   tcp   connect   char   use   RKE   

原文地址:http://blog.51cto.com/12473494/2316550

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!