Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Node And apache together in amazon ec2?

hi i have an ec2 instance at amazon which runs on normal 80 port and i have a node running on 3002 port how can i make my node run on port 80 in my amazon ec2 instance along with apache i tried most of online tutorials like reverseproxy mod proxy etc on apache

i need to run my node server on www.mywebsite.com/node now its running on www.mywebsite.com:3002/

i tried to edit my

/etc/httpd/conf/httpd.conf

Of apache like below but had no effect whatsoever

<VirtualHost *:80>

ProxyRequests off

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

<Location />
    ProxyPass /node http://localhost:3002/
    ProxyPassReverse /node http://localhost:3002/
</Location>
</VirtualHost>
like image 783
Sebin P Johnson Avatar asked Jun 03 '15 06:06

Sebin P Johnson


People also ask

Can I use Apache with node?

To configure the Apache server for the Node application, we'll follow these steps: Confirm the Apache server is running. Create the Apache configuration file. Enable the proxy and proxy_http modules.

What are the 3 different methods that you connect to a EC2 instance?

Connect using a standalone SSH client. Connect using Session Manager. Connect using browser-based SSH connection.


1 Answers

I've not used apache for ages now but I think your location for mod_proxy would look like:

<Location /node >
    ProxyPass http://localhost:3002/
</Location>

Also, have you restarted apache?

service httpd restart should do it.

like image 68
Samar Avatar answered Sep 30 '22 16:09

Samar