代理http配置如下
server {
listen 20075 ;
server_name localhost;
location / {
root html;
index index.html index.htm;
proxy_pass http://8.8.8.8;
}
}
proxy_pass为要转发的服务器
listen为要监听的端口号
代理https配置如下
server {
listen 20076 ssl ;
server_name localhost;
ssl_certificate pem.pem;
ssl_certificate_key key.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
ssl_prefer_server_ciphers on;
location / {
proxy_next_upstream http_500 http_502 http_503 http_504 timeout error invalid_header;
proxy_pass http://8.8.8.8;
}
}
ssl_certificate pem文件的路径
ssl_certificate_key key文件的路径