Apache Reverse Proxy
Jintiansheng: Insisting on writing is not an easy thing, in other words, sticking to itself is not an easy thing. If learning has a shortcut, it is to continue to practice, and constantly accumulate. Writing notes, in fact, is to show their own, is to reflect the accumulation of a way to adhere to. Golden days: 15998603918 Welcome to chat with me.
I have developed a set of node. JS Web applications, want to implement the HTTPS protocol, as for node. JS Native Implementation HTTPS Protocol I did not study here.
In fact, the default node. JS Express listens on Port 3000, the HTTP protocol.
What if I want to access the node. js app over HTTPS? Direct use of Apache reverse proxy function.
Configure the Apache configuration file, the author here in apache/conf/extra/httpd-vhosts.conf, add VirtualHost configuration:
<VirtualHost*:443>ServerName www.mydomain.com<Proxy*>Order Deny,allowallow from all</Proxy>sslengine onsslproxyengine onsslproxyverify nonesslproxycheckpeercn offsslproxycheckpeername Offsslcertificatefile "CONF/SSL.CRT/SERVER.CRT" Sslcertificatekeyfile "Conf/ssl.key/server.key" ProxyRequests Offproxypreservehost onproxypass/http://127.0.0.1:3000/proxypassreverse/http://127.0.0.1:3000/</VirtualHost>
This way, https://127.0.0.1 can access the contents of http://127.0.0.1:3000 by restarting the Apache server.
Of course, here is an example, the real production environment, the need to generate their own replacement of the above certificate, domain name, port and other information.
Apache reverse Proxy implements the cloak to add HTTPS for HTTP