我正在使用node / express创建一个Web应用程序,我想使用http和https在本地测试它作为vhost。目前我的快递应用通过端口3080和3443(例如:http://localhst:3080
和https://localhost:3443
)在http和https上正常收听和工作正常。
然后我使用以下代码通过apache创建了vhost:
<VirtualHost *:80>
ServerName mynodedomain.com
ServerAlias www.mynodedomain.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:3080/
ProxyPassReverse http://localhost:3080/
</Location>
DocumentRoot "/Library/WebServer/Documents/mynodedomain.com/webapp/public"
ErrorLog "/private/var/log/apache2/mynodedomain.com-error_log"
CustomLog "/private/var/log/apache2/mynodedomain.com-access_log" common
</VirtualHost>
它工作正常,我可以通过http://mynodedomain.com
访问快递应用。我想要做的是我应该可以通过https://mynodedomain.com
访问该网站,它应该转发到http://localhost:3443/
。我按照方式尝试了
<VirtualHost *:443>
ServerName mynodedomain.com
ServerAlias www.mynodedomain.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass https://localhost:3443/
ProxyPassReverse https://localhost:3443/
</Location>
DocumentRoot "/Library/WebServer/Documents/mynodedomain.com/webapp/public"
ErrorLog "/private/var/log/apache2/mynodedomain.com-error_log"
CustomLog "/private/var/log/apache2/mynodedomain.com-access_log" common
</VirtualHost>
但它不起作用。你能告诉我一个正确的方法吗?谢谢