使用Apache 2.4.29在子域上的Proxypass nodejs app

时间:2018-03-06 10:58:52

标签: node.js apache reverse-proxy mod-proxy proxypass

我使用的应用是Lolisafe,它会打开一个本地端口到9999。

对于我的域名,我需要使用常规网站(https://example.com),还要有子域名(https://sub.example.com)链接到nodejs应用程序,该应用程序在下有一个home.html页面/ SRV / HTTP / lolisafe /页/ 即可。 Lolisafe还使用在/ api下调用的API,因此例如https://sub.example.com/api是登录函数的方式。

我的所有域名文件都位于/ srv / http

的httpd.conf:

Include conf/extra/site/domain.conf
Include conf/extra/site/lolisafe.conf

为@,www和lolisafe设置记录,所有记录都使用相同的IP。

目前我的/etc/httpd/conf/extra/site/domain.conf文件包含:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "/srv/http/"

ServerName example.com
ServerAlias www.example.com

ErrorLog "/var/log/httpd/example.com-error_log"
CustomLog "/var/log/httpd/example.com-access_log" common
Redirect permanent / https://example.com/

</VirtualHost>

<VirtualHost *:443>
ServerAdmin admin@example.com
DocumentRoot "/srv/http/"

ServerName domain.com
ServerAlias www.domain.com

ErrorLog "/var/log/httpd/example.com-error_log"
CustomLog "/var/log/httpd/example.com-access_log" common

SSLEngine on
SSLCACertificateFile /etc/httpd/conf/ca_bundle.crt
SSLCertificateFile /etc/httpd/conf/server.crt
SSLCertificateKeyFile /etc/httpd/conf/server.key

</VirtualHost>

/etc/httpd/conf/extra/site/lolisafe.conf包含:

<VirtualHost *:*>
    ProxyPreserveHost On
    ServerName lolisafe.example.com
    DocumentRoot     "/srv/http/lolisafe/pages/"
    ProxyPass        "/" "http://0.0.0.0:9999/"
    ProxyPassReverse "/" "http://0.0.0.0:9999/"
</VirtualHost>

目前,通过此设置,访问https://sub.example.com会直接转到https://example.com。我做错了什么?

0 个答案:

没有答案