最近開始學習 Nodejs ,可是機子上已經有了 apache ,因此爲了跑 Node ,就查詢資料使用apache代理nodejs服務進行工做。node
<VirtualHost *:80>
web
ServerName www.webtest.com
express
ServerAlias www.webtest.com
apache
ProxyRequests off
app
<Proxy *>
socket
Order deny,allow
學習
Allow from all
ui
</Proxy>
socket.io
<Location />
代理
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>
</VirtualHost>
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.send('<h1>Welcome Realtime Server</h1>');
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
訪問咱們配置的虛擬主機 www.webtest.com