Назад | Перейти на главную страницу

Настройка обратного прокси с Apache на Node.js

Я пытаюсь настроить обратный прокси-сервер от Apache к приложению Node.js / Express.js, прослушивающему порт 8000. На этом сервере установлена ​​cpanel, но у меня есть доступ по ssh, и я почти игнорирую cpanel. Я добавил следующее в начало моих httpd.conf.

<VirtualHost 97.74.237.44:80>
    ServerName node.dealerdigitalgroup.com
    ServerAlias www.node.dealerdigitalgroup.com
    DocumentRoot /home/mydomain/public_html/node
    UseCanonicalName Off
    Options -Indexes
    ProxyRequests on
    ProxyPass / http://localhost:8000/
</VirtualHost>

Я перезапустил httpd и запустил свое приложение. Теперь, когда я пытаюсь получить доступ node.dealerdigitalgroup.com Я получаю индексную страницу, но это занимает больше времени, чем должно, и узел регистрирует длинный список ошибок.

> node app.js
Listening on port 8000
GET /403.shtml 404 6.307 ms - 9
GET /403.shtml 404 1.113 ms - 9
GET /500.shtml 404 0.566 ms - 9
GET /403.shtml 404 0.266 ms - 9
GET /403.shtml 404 0.262 ms - 9
GET /403.shtml 404 0.291 ms - 9
GET /403.shtml 404 0.341 ms - 9
GET /403.shtml 404 0.863 ms - 9
GET / 200 205.543 ms - 170
GET /403.shtml 404 0.418 ms - 9
GET /403.shtml 404 0.212 ms - 9
GET /stylesheets/style.css 200 67.533 ms - 110
GET /503.shtml 404 0.366 ms - 9
GET /403.shtml 404 0.508 ms - 9
GET /403.shtml 404 0.266 ms - 9
GET /400.shtml 404 0.375 ms - 9
GET /503.shtml 404 0.500 ms - 9
GET /403.shtml 404 0.181 ms - 9
GET /403.shtml 404 0.367 ms - 9
GET /403.shtml 404 9.250 ms - 9
.....

Это продолжается до тех пор, пока я не убью свое приложение узла.

Когда я приезжаю node.dealerdigitalgroup.com:8000 все работает так, как должно, поэтому это должна быть проблема конфигурации с apache.

> apachectl -S
VirtualHost configuration:
127.0.0.1:80           is a NameVirtualHost
         default server s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
         port 80 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
127.0.0.1:443          s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1241)
97.74.237.44:443       is a NameVirtualHost
         default server shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:1139)
         port 443 namevhost shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:1139)
         port 443 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1241)
97.74.237.44:80        is a NameVirtualHost
         default server node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:27)
         port 80 namevhost node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:27)
         port 80 namevhost 97.74.237.44 (/usr/local/apache/conf/httpd.conf:276)
         port 80 namevhost dealerdigitalgroup.net (/usr/local/apache/conf/httpd.conf:298)
         port 80 namevhost dealerdigitalmarketing.com (/usr/local/apache/conf/httpd.conf:336)
         port 80 namevhost dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:374)
         port 80 namevhost lakeautobody.com (/usr/local/apache/conf/httpd.conf:412)
         port 80 namevhost riversidedodge.com (/usr/local/apache/conf/httpd.conf:450)
         port 80 namevhost shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:488)
         port 80 namevhost fakedomain.com (/usr/local/apache/conf/httpd.conf:526)
         port 80 namevhost theaddept.com (/usr/local/apache/conf/httpd.conf:565)
         port 80 namevhost homeloansdoctor.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:603)
         port 80 namevhost tradeestimator.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:641)
         port 80 namevhost pedderautogroup.tradeestimator.com (/usr/local/apache/conf/httpd.conf:679)
         port 80 namevhost temeculanissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:717)
         port 80 namevhost cardinero.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:755)
         port 80 namevhost dashboard.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:793)
         port 80 namevhost racewaynissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:831)
         port 80 namevhost testbuild.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:869)
         port 80 namevhost peddernissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:907)
         port 80 namevhost forms.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:945)
         port 80 namevhost hemetcdjr.tradeestimator.com (/usr/local/apache/conf/httpd.conf:983)
         port 80 namevhost lakecdjr.tradeestimator.com (/usr/local/apache/conf/httpd.conf:1021)
         port 80 namevhost node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:1059)
         port 80 namevhost fitness19covina.dealerdigitalgroup.net (/usr/local/apache/conf/httpd.conf:1097)
         port 80 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:288)
         port * namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:288)
Syntax OK