nginx
Nginx is a high-performance HTTP server and reverse proxy
Only root listening on port 80, when we will port into 1 1.8 80 This error will occur:Error: listen EACCES: permission denied 0.0.0.0:80
One way: listening on port 80 with the root user
Second way: root start nginx, nginx forwarded to the node
A mounting (root user) Nginx
apt-get install nginx
复制代码
Two, nginx command
name | command |
---|---|
Start nginx | nginx -c /etc/nginx/nginx.conf |
Close nginx | nginx -s stop |
Reread the configuration file | nginx -s reload kill -HUP nginx |
Common Commands | service nginx {start | stop | status | restart | reload | configtest} |
Three, nginx configuration
include /etc/nginx/conf.d/*.conf; nginx configuration itself
include / etc / nginx / sites- enabled / *; ligand site (root directory defaults to the / var / www / html, delete the default default)
cd /etc/nginx/sites-enabled
sudo vi webserver
# 配置如下
server {
listen 80;
server_name 47.103.198.148;
location / { #配置路由
proxy_pass http://47.103.198.148:8080;
}
}
sudo nginx -s reload #重启nginx
复制代码
pm2 start server.js --name 'webserver'
复制代码
http://47.103.198.148
Access the page to see the results of it
To be continued ...
Reproduced in: https: //juejin.im/post/5cfe2c486fb9a07f0219f569