Netcore API和Vue前后端项目 发布到Centos 步骤

1、Centos 安装 SqlSever 2017

2、Centos 安装 mysql

3、Centos 安装.NET CORE 3.1

4、Centos 安装nginx

5、Centos 安装nodejs

6、Centos 安装pm2

7、Vue 项目上线到 Centos 系统

8、NetCore API项目发布到Centos

1)上传 发布文件到 Nginx 网站文件目录

2)配置 Nginx 的 配置文件

进入目录 /etc/nginx 修改配置文件nginx.conf

server {
        listen 80;
        server_name 49.233.12.12;
        location / {
            proxy_set_header   Host      $http_host;
            proxy_pass         http://127.0.0.1:8081;
            proxy_redirect     off;
            proxy_set_header   X-Real-IP       $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

重新加载Nginx 配置

nginx -s reload

启动Nginx

nginx

重启 Nginx

service nginx restart

 出现以下,说明端口在使用

 查询所有端口使用进程

netstat -ntlp

 杀死进程重启:

[root@VM_0_13_centos /]# kill -9 1130
[root@VM_0_13_centos /]# kill -9 8297
[root@VM_0_13_centos /]# kill -9 12972
[root@VM_0_13_centos /]# nginx
[root@VM_0_13_centos /]# 

这样就OK了

原文地址:https://www.cnblogs.com/shuaichao/p/12969321.html