1,查看httpd.conf是不是加载了mod_proxy.so,mod_proxy_http.so二个模块

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

2.apache代理nodejs,配置apache的一个虚拟机,位置:/etc/httpd/conf/httpd.conf

<VirtualHost *:999>
   #ServerAdmin admin@localhost
   ServerName blog.allsmy.com
   ProxyRequests off     //off表示反向代理
   <Proxy *>
       Order deny,allow
       Allow from all      //proxy的访问控制
   </Proxy>
   <Location />
       ProxyPass http://127.0.0.1:2368/         //反向代理到本地nodejs占用2368端口
       ProxyPassReverse http://127.0.0.1:2368/  //反向代理到本地nodejs占用2368端口
    </Location>
</VirtualHost>

3.nginx代理apache,位置:/etc/nginx/conf.d/apache.cnf

server {
    listen       80;
    server_name  localhost;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/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    Host        $http_host;
         proxy_pass          http://127.0.0.1:999;
    }

4.重启2个服务器:

servcie httpd restart
service nginx restart

参考原文:http://blog.51yip.com/apachenginx/1594.html