Nodejs Study Notes

Source: Internet
Author: User

Beginner, simple implementation, for optimization.

1. Assume that the Nodejs server is listening on port 3000

2. Apache Reverse proxy settings

A. Opening the proxy module in the httpd.conf configuration file

LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.soLoadModule proxy_http_module modules/mod_proxy_http.so

B. Introduction of the VirtualHost configuration file httpd-vhosts.conf

Include conf/extra/httpd-vhosts.conf

C. Configure the listening port in httpd.conf, this is the case of Port 8010, you can set the other ports yourself

Listen 8010

D. Declaring a port that matches httpd.conf in httpd-vhosts.conf

NameVirtualHost *:8010

E. Reverse proxy settings in httpd-vhosts.conf

<VirtualHost *:8010>    ServerName www.socketio.chat.com    ServerAlias socketio.chat.com         ErrorLog "logs/socketio.com-error.log"    CustomLog "logs/socketio.com-access.log"common     ProxyRequests Off    <Proxy *>      Order deny,allow      Allow from all    </Proxy>        #反向代理设置    ProxyPass / http://localhost:3000/    ProxyPassReverse / http://localhost:3000/</VirtualHost>

 

3. The configuration is complete, access to the localhost:8010 can be accessed to the Nodejs service through 3000 port services

4. Unresolved issues

A. The client first access localhost:8010 will return 502 information, waiting for about 3s to connect the Nodejs service, do not know whether it is socketio or Apache or Nodejs

B. Nodejs server will continue to set/clear heartbeat, even if no data need to push the day after tomorrow, the client will still receive polling data regularly

C. Client connection is not stable, drop line frequently

Nodejs Study Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.