Learning is like rowing upstream
1. You need to install Node. js first. I used NVM to install node.js, so it’s easier to control the version.
Sudo apt-get install Nginx sudo apt-get install Nginx
3. Go to /etc/nginx directory and check the nginx.conf configuration file.
# include /etc/nginx/conf.d/*.conf;
# include /etc/nginx/sites-enabled/*;Copy the code
Check to see if you have commented out these two sentences. If so, remove the # sign. If not, skip this step.
/etc/nginx/conf.d/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf/rockjenns-com-8081.conf
Upstream {server 127.0.0.1:8081; My project runs on port 8081 with keepalive 64; } server { listen 80; Server_name 39.108.55.xxx www.rockjins.com rockjins.com; Location / {proxy_set_header x-real-ip $remote_addr; / {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_set_header Connection ""; proxy_pass http://rockjins; (110: while (" upstream ") (" upstream "))Copy the code
Sudo nginx -t () : nginx -t () : nginx -t () : nginx -t () : nginx -t ();
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfulCopy the code
Sudo service Nginx reload; sudo service Nginx reload;
7. The last step made me miserable, which lasted all night. It was the problem of the security team. (SSH Operation timed out)
Because the service runs on port 8081, the security group of Ali Cloud rejects authorization policies above port 4000 by default, so you must remember to add security group rules, as shown in the figure:
8. Open your browser and enter your IP address or domain name to proxy port 8081 to port 80.
I hope this article can help you and save you some unnecessary waste of time. If you have any problems, please contact me and make progress together.
Copyright notice: All articles on this Blog are licensed under CC BY-NC-SA 3.0CN, unless otherwise specified. Reprint please indicate the source!