The operating environment of this article is centOS 7
Install through yum
1, Add nginx to yum Repro library [root@izbp1b498epn4trb75oykez ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm2, check nginx information [root@izbp1b498epn4trb75oykez ~]# yum info nginx3, install ngnix with yum [root@izbp1b498epn4trb75oykez ~]# yum -y install nginx4, Start nginx [root@izbp1b498epn4trb75oykez ~]# systemctl start nginx
Copy the code
Nginx configuration
- If you are following me step-by-step, your Nginx configuration file address should be the same as mine
[root@izbp1b498epn4trb75oykez ~]# vi /etc/nginx/conf.d/default.confAdd a new server that listens on port 80 and forwards requests from dev.jindll.com to port 4355 server {listen 80; server_name dev.jindll.com; location / { proxy_pass_header Server; proxy_set_header Host$http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme; Proxy_pass http://127.0.0.1:4355; }}Copy the code
- Save the configuration and exit. Then restart nginx for the configuration to take effect
[root@izbp1b498epn4trb75oykez conf.d]# systemctl reload nginx.service
Copy the code
Domain name A Records are resolved to the server IP address
Four, extension,
CentOS 7 Run the systemctl start service name. service command to start a service
Eg: Start nginx systemctl start nginx.service
To stop a service, run the systemctl stop command
Eg: Stop nginx systemctl stop nginx.service
To restart a service, run the systemctl restart command
Displays the status of a service: systemctl status Service name.service
Run the systemctl enable command to start a service
To disable a service during startup: systemctl disable Service name.service
Five, the subsequent
- Nginx installation and configuration end, next chapter will be about Linux installation node and PM2 deployment nodeJS service, if there is any error welcome to the comment area. 🎉 🎉 🎉 🎉
Related articles
Nodejs installation and Service Deployment (2)