YUMSERV
Published 2019. 6. 1. 14:02
Node.js + Nginx 연동 LINUX/WEB
반응형

# vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r; 
#access_log /var/log/nginx/host.access.log main; 
location / { 
root /usr/share/nginx/html; 
index index.html index.htm; 
proxy_set_header X-Real-IP $remote_addr; 
proxy_set_header X_Forwarded_For $proxy_add_x_forwarded_for; 
proxy_set_header Host $http_host; 
proxy_set_header X_NginX_Proxy true; 
proxy_pass http://127.0.0.1:3000/; 
proxy_redirect off; 
}

 

# vi /usr/share/nginx/html/test.js
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello World\n’);
}).listen(3000, “127.0.0.1”);
console.log(‘Server running at http://127.0.0.1:3000/’);


# node test.js



반응형

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

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

YUMSERV

@lena04301

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