duanba2001 2016-07-21 14:28
浏览 477
已采纳

如何在Apache服务器上运行没有端口号的nodejs

I have a nodejs api application running inside a codeigniter environment. Im trying to access the nodejs api's without using a port number in the url

currently you can only hit the node api at

http://wrl.xx.com:8010/api

And I would like to have it accessible through a url like :

http://wrl.xx.com/api/

I tried to run a reverse proxy with no success

<VirtualHost *:80>
ServerName wrl.xx.com

ProxyRequests off

<Proxy *>
        Order allow,deny
        Allow from all
</Proxy>

ProxyPass / http://localhost:8010/
ProxyPassReverse / http://localhost:8010/
ProxyPreserveHost on
</VirtualHost>
  • 写回答

2条回答 默认 最新

  • dongxun1244 2016-07-21 20:26
    关注

    Assuming you intend to differentiate requests looking for the nodejs app from requests seeking the codigniter app by seeing /api as the root path, try:

    ProxyPass /api http://localhost:8010/api
    ProxyPassReverse /api http://localhost:8010/api
    

    See ProxyPass and ProxyPassReverse for more magic.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?