


nginx reverse proxy deployment nodejs nginx reverse proxy nodejs nodejs framework nginx proxy nodej
In the node development stage, the http
module is generally used to start a local server for easy debugging.
It probably looks like this:
<code><span>var</span> http = <span>require</span>(<span>"http"</span>); <span>var</span> server = http.createServer(); server.listen(<span>8888</span>);</code>
Then the question is, my application has been formed, how should I deploy it to vps? You can’t use it againhttp://10.88.77.66:8888
Come and visit, right? Yes the title of the article is the solution.
My environment is roughly like this centos 6
using lnmp one-click deployment
. As for how to operate lnmp
, I won’t write about it. Google by yourself
Suppose my domain name is money.ivan.com
I want to proxy it to http://10.88.77.66:8888
, then modify the nginx config file of the corresponding domain name
<code>upstream nodejs { server <span>127.0</span><span>.0</span><span>.1</span>:<span>8888</span>; <span>#server</span><span>127.0</span><span>.0</span><span>.1</span>:<span>8888</span>; keepalive <span>64</span>; } server { listen <span>80</span>; server_name money<span>.</span>ivan<span>.</span>com; access_log /home/wwwlogs/money<span>.</span>ivan<span>.</span>com<span>.</span><span>log</span> access; location <span>/</span> { proxy_set_header X<span>-Real</span><span>-IP</span><span>$remote_addr</span>; proxy_set_header X<span>-Forwarded</span><span>-For</span><span>$proxy_add_x_forwarded_for</span>; proxy_set_header Host <span>$http_host</span>; proxy_set_header X<span>-Nginx</span><span>-Proxy</span><span>true</span>; proxy_set_header Connection <span>""</span>; proxy_pass http:<span>//nodejs;</span> } }</code>
through the above modifications , make nginx reverse proxy to our site. You can access our application through money.ivan.com
.
The above introduces the nginx reverse proxy deployment of nodejs, including the content of NodeJS and nginx. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To allow the Tomcat server to access the external network, you need to: modify the Tomcat configuration file to allow external connections. Add a firewall rule to allow access to the Tomcat server port. Create a DNS record pointing the domain name to the Tomcat server public IP. Optional: Use a reverse proxy to improve security and performance. Optional: Set up HTTPS for increased security.

The main differences between Node.js and Java are design and features: Event-driven vs. thread-driven: Node.js is event-driven and Java is thread-driven. Single-threaded vs. multi-threaded: Node.js uses a single-threaded event loop, and Java uses a multi-threaded architecture. Runtime environment: Node.js runs on the V8 JavaScript engine, while Java runs on the JVM. Syntax: Node.js uses JavaScript syntax, while Java uses Java syntax. Purpose: Node.js is suitable for I/O-intensive tasks, while Java is suitable for large enterprise applications.

To connect to a MySQL database, you need to follow these steps: Install the mysql2 driver. Use mysql2.createConnection() to create a connection object that contains the host address, port, username, password, and database name. Use connection.query() to perform queries. Finally use connection.end() to end the connection.

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

Node.js is a JavaScript runtime environment and npm is its package manager. The two work together to enable developers to write server-side programs in JavaScript, use third-party modules, and easily manage modules.

Node.js is suitable for the following project types: Network and server applications Event-driven applications Real-time applications Data-intensive applications Command-line tools and scripts Lightweight microservices

Steps to connect MyCAT in Node.js: Install the mycat-ts dependency. Create a connection pool, specify the host, port, username, password and database. Use the query method to execute SQL queries. Use the close method to close the connection pool.

To successfully deploy and maintain a PHP website, you need to perform the following steps: Select a web server (such as Apache or Nginx) Install PHP Create a database and connect PHP Upload code to the server Set up domain name and DNS Monitoring website maintenance steps include updating PHP and web servers, and backing up the website , monitor error logs and update content.
