nodejs domain without port number

后端 未结 3 1576
被撕碎了的回忆
被撕碎了的回忆 2020-12-13 05:50

I have deployed my nodejs app on a VPS(ubuntu 10.04). I have hosted it on a subdomain (subdomain.myapp.com:3000) and I just have one IP address

By default port 80 is

3条回答
  •  醉梦人生
    2020-12-13 06:22

    Yes it is possible

    In your apache virtual host file configure with the following

    
        ServerName subdomain.myapp.com
    
        ProxyRequests off
    
        
                Order allow,deny
                Allow from all
        
    
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/
        ProxyPreserveHost on
    
    

    You should have

    NameVirtualHost *:80
    

    on top of your file and also Proxy module installed for apache ( I think it is a default configuration for ubuntu )

    LoadModule proxy_module lib/httpd/modules/mod_proxy.so
    

    it must be in your httpd.conf file

    then you should restart apache and it must be fine!

提交回复
热议问题