无法让Apache反向代理我的node.js应用(https)

时间:2018-07-11 22:33:58

标签: node.js linux apache proxy server

我正在尝试通过仅在常规域中键入而不是在末尾附加开发端口(:8081)来运行我的节点应用程序。我似乎无法正常运行,似乎我在conf文件中设置的反向代理虚拟主机被忽略了。我的httpd.conf文件会自动生成,因此我将它放在pre_virtualhost_global.conf文件中:

<VirtualHost *:443>    
    ServerName www.statementdigest.com
    SSLEngine On
    ProxyPreserveHost On
    ProxyRequests Off

   <Directory "/home/statementdigest/myapp">
       AllowOverride All
   </Directory>
    # Set the path to SSL certificate
    # Usage: SSLCertificateFile /path/to/cert.pem
    SSLCertificateFile /var/cpanel/ssl/cpanel/mycpanel.pem
    SSLCertificateKeyFile /var/cpanel/ssl/cpanel/mycpanel.pem
    SSLCertificateChainFile /var/cpanel/ssl/cpanel/mycpanel.pem    

    # Servers to proxy the connection, or;
    # List of application servers:
    # Usage:
    # ProxyPass / http://[IP Addr.]:[port]/
    # ProxyPassReverse / http://[IP Addr.]:[port]/
    # Example:

   <Location /appserver.js>
      ProxyPass http://127.0.0.1:8081
      ProxyPassReverse http://127.0.0.1:8081
   </Location>

    # Or, balance the load:
    # ProxyPass / balancer://balancer_cluster_name

</VirtualHost>

apachectl -S显示

173.237.185.229:80     is a NameVirtualHost
         default server 173.237.185.229 (/etc/apache2/conf/httpd.conf:259)
         port 80 namevhost 173.237.185.229 (/etc/apache2/conf/httpd.conf:259)
                 alias server.statementdigest.com
         port 80 namevhost statementdigest.com (/etc/apache2/conf/httpd.conf:325)
                 alias mail.statementdigest.com
                 alias www.statementdigest.com
         port 80 namevhost proxy-subdomains-vhost.localhost (/etc/apache2/conf/httpd.conf:523)
                 wild alias cpanel.*
                 wild alias whm.*
                 wild alias webmail.*
                 wild alias webdisk.*
                 wild alias cpcalendars.*
                 wild alias cpcontacts.*
173.237.185.229:443    is a NameVirtualHost
         default server statementdigest.com (/etc/apache2/conf/httpd.conf:394)
         port 443 namevhost statementdigest.com (/etc/apache2/conf/httpd.conf:394)
                 alias mail.statementdigest.com
                 alias www.statementdigest.com
                 alias cpanel.statementdigest.com
                 alias webdisk.statementdigest.com
                 alias whm.statementdigest.com
                 alias webmail.statementdigest.com
         port 443 namevhost proxy-subdomains-ssl-default-vhost.localhost (/etc/apache2/conf/httpd.conf:624)
                 wild alias cpanel.*
                 wild alias whm.*
                 wild alias webmail.*
                 wild alias webdisk.*
                 wild alias cpcalendars.*
                 wild alias cpcontacts.*
         port 443 namevhost server.statementdigest.com (/etc/apache2/conf/httpd.conf:755)
127.0.0.1:80           proxy-subdomains-vhost.localhost (/etc/apache2/conf/httpd.conf:523)
127.0.0.1:443          proxy-subdomains-ssl-default-vhost.localhost (/etc/apache2/conf/httpd.conf:624)
*:*                    server.statementdigest.com (/etc/apache2/conf/httpd.conf:285)
*:443                  is a NameVirtualHost
         default server www.statementdigest.com (/etc/apache2/conf.d/includes/pre_virtualhost_global.conf:4)
         port 443 namevhost www.statementdigest.com (/etc/apache2/conf.d/includes/pre_virtualhost_global.conf:4)
         port 443 namevhost server.statementdigest.com (/etc/apache2/conf/httpd.conf:755)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/etc/apache2/htdocs"
Main ErrorLog: "/etc/apache2/logs/error_log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: dir="/run/apache2" mechanism=fcntl
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex rewrite-map: dir="/run/apache2" mechanism=fcntl
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/run/apache2/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODSEC_2.5
Define: MODSEC_2.9
User: name="nobody" id=99
Group: name="nobody" id=99
域中的

键入仍然会路由到cgi-bin页面,因此虚拟主机代理似乎只是被忽略了。我很乐意提供所需的更多详细信息,请询问。我一直在努力研究这几天,但是我有点卡住了,非常感谢您的帮助或指导,谢谢!

0 个答案:

没有答案