YUMSERV
Published 2019. 6. 1. 13:55
Node.js + Apache 연동 LINUX/WEB
반응형

설치 환경 : node.js : 10.7 Apache 2.4 소스설치

 

# vi /usr/local/apache/conf/httpd.conf

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

 

# vi /usr/local/apache/conf/extra/httpd-vhost.conf

<VirtualHost *:80>

DocumentRoot “/usr/local/apache/htdocs/”
ServerName IP주소
ErrorLog “logs/error_log”
CustomLog “logs/access_log” common
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

<Location />
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/

</Location>

</VirtualHost>

 

홈 디렉토리 안에 test.js 파일을 만들어서 테스트를 진행하였습니다.

# vi test.js
var http = require(“http”);
http.createServer(function(req, res) {
res.writeHead(200, {“Content-Type”: “text/plain”});
res.write(“Hello\r\n”);
res.write(“World\r\n”);
res.end();
}).listen(3000);

 

# node test.js
혹은 백그라운드에서 실행

 

# netstat -nltp | grep 3000
tcp6 0 0 :::3000 :::* LISTEN 6331/node


반응형

'LINUX > WEB' 카테고리의 다른 글

Ubuntu APM 설치  (0) 2019.06.01
Node.js + Nginx 연동  (0) 2019.06.01
node js 소스 설치  (0) 2019.06.01
JAVA + Tomcat + Nginx 연동  (0) 2019.05.29
Java + Tomcat + Apache 연동  (0) 2019.05.29
profile

YUMSERV

@lena04301

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!