在ubuntu中使用sudo a2enmod proxy
和sudo a2enmod proxy_http
。
在windows中使用去掉httpd.conf中的LoadModule proxy_module modules/mod_proxy.so
和LoadModule proxy_http_module modules/mod_proxy_http.so
前的注释nginx
在windows中配置httpd.conf文件,在ubuntu中配置site_enabled中具体网站的参数apache
ProxyRequests Off <Proxy *> Require all granted </Proxy> ProxyPass /backward http://localhost:7000
server { listen 8000; # listen somename:8080; server_name somename alias another.alias; location / { proxy_pass https://www.piwheels.org; proxy_ssl_server_name on; proxy_redirect default; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
proxy_ssl_server_name on;是为了解决一下问题:ubuntu
SSL_do_handshake() failed (SSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure) while SSL handshaking to upstreamwindows
出现错误的缘由:
nginx反向代理的时候默认没有将 server_name 发给上游服务(被代理的服务)。若是上游服务器配置了多个证书,这会致使上游服务器没法给出正确的证书来通讯,进而致使握手失败。开启proxy_ssl_server_name指令后,nginx在与上游服务进行TLS协商时,会发送server_name。
proxy_redirect default;是为了解决:
在服务器中有可能会进行403跳转,打开该设置后,nginx会自动对域名进行替换。服务器