Node application, app.js with a "Hello World" output has been tested on CentOS 7.9.2009 ie
$ node app.js->> Server running at http://localhost:8000/
$ curl http://localhost:8000->> “Hello World”*
The following has been added to /etc/httpd/conf.modules.d/00-proxy.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
The following file was created /etc/httpd/conf.d/myserver.com.conf with the contents below
<VirtualHost *:80>
ServerName myserver.com
ServerAlias www.myserver.com
ProxyRequests On
ProxyPass /node http://localhost:8000/
ProxyPassReverse /node http://localhost:8000/
Restarted apache -> $ sudo systemctl restart httpd
When I try to access https://www.myserver.com/node from browser, I get a 403 error. When using https://www.myserver.com:8000 there is no response. Is it because of the https? What else do I need to do?
Asked
Active
Viewed 113 times
0

GridCode
- 1
- 1
-
What is the result when you access the URL `http://www.myserver.com/node` ? – Đăng Khoa Đinh Jun 13 '21 at 09:03
-
1I have solved it using https://stackoverflow.com/questions/9831594/apache-and-node-js-on-the-same-server?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa as a guide. – GridCode Jun 13 '21 at 11:45
-
For CentOS 7, this is what I did a. Add these lines ProxyPass /node http://localhost:8000/ #ProxyPassReverse /node http://localhost:8000/ to /etc/httpd/conf/httpd.conf b. Ensure that these lines LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so are uncommented in /etc/httpd/conf.modules.d/00-proxy.conf – GridCode Jun 13 '21 at 11:45
-
I have commented out this #ProxyPassReverse /node localhost:8000 in /etc/httpd/conf/httpd.conf. Not sure whether is needed but https://www.myserver.com/node is now working – GridCode Jun 13 '21 at 11:48