Run a NodeJS app with Apache

后端 未结 1 968
孤街浪徒
孤街浪徒 2021-01-01 07:47

I have a ubuntu server running a few apache websites. I want to run a nodejs app on the same server. I have the app running on the server now out of port 3000 (www.example.c

相关标签:
1条回答
  • 2021-01-01 08:42

    First of all, you should to install mod_proxy and mod_proxy_http.

    Then you can use something like the following configuration:

    <VirtualHost *:80>
      ServerAdmin spam@example.com
      ServerName example.com
      ServerAlias www.example.com 
    
      ProxyRequests off
    
      <Proxy *>
        Order deny,allow
        Allow from all
      </Proxy>
    
      <Location />
        ProxyPass http://localhost:3000/
        ProxyPassReverse http://localhost:3000/
      </Location>
    </VirtualHost>
    
    0 讨论(0)
提交回复
热议问题