linux nginx+ssl安装

下载nginx-1.9.9.tar.gz,上传至/usr/local目录

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
cd /usr/local
tar -zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install

nginx的nginx.conf配置参考,这里配置的是443转内部8080

user  root;
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        server_name  localhost;
	    listen 443 ssl;
	    ssl_certificate server.crt;
	    ssl_certificate_key server.rsa;
	   location / {
            proxy_pass http://localhost:8080;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
	        client_max_body_size    1000m;
	    }
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

你可能感兴趣的:(linux)