Continued articles, I get a long time reverse mapping. . . God, though, finally succeeded.
After installing NetCore SDK and nginx, deployed in a centos above, and reverse mapping with nginx, to visit;
One: Open VisualStudio2019, or visualStudio2017 can create a new core of MVC project, I will not say more, just to create a line, on the map:
Then we released it,
Well, we are going to invite to use ftp tool, here it customary to personal use, ftp tool is also very much, I still follow video tutorial is used, (for example: FileZilla, lrzsz etc. can own Baidu View)
Then open through ssh centos, to see if the transfer was successful; (execute the command: cd / and then execute: cd / home / netcore View execute the command: ls)
Then we start the next try (in the directory), execute the command: dotnet NetCoreDemo.dll; results are as follows:
You can re-open a putty, try to open the case to access, execute the command: curl: http: // localhost: 5000; (not demonstrated here)
OK, next to the most annoying of the time, because after I finished the last configuration nginx, can not always accessible, more or less, there will be a problem, okay okay, finally I did it,
We return to the root directory and execute: cd / etc / nginx /
Edit nginx.conf this configuration with vi, (here is configured to listen on port 80 to access);
(Note: The last people that brackets do not comment ah;)
Vi finished with change save and exit;
Then cd conf.d this directory, execute vi core.conf (core.conf does not matter does not exist, we execute vi core.conf command line, it is automatically created with vi);
We write into the following configuration;
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
保存退出,退出后执行nginx -s reload命令进行重启nginx;这个时候。。。或多或少就会有些问题;不过或许没问题;
比如问题就如下了:
root@VM_0_15_centos conf.d]# nginx -s reload
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
这个我在网上查过了,是每次重启nginx之后这个pid会丢失;这应该是因为把nginx进程杀死后pid丢失了,下一次再开启nginx -s reload时无法启动;话说我重装了好几次nginx。。无力吐槽;
贴一下别人遇到这个问题的的博文链接,https://blog.csdn.net/llnara/article/details/8691049;
我看了下,应该是找不到nginx.conf这个配置在哪了,重新指向一下,执行命令:sudo nginx -c /etc/nginx/nginx.conf;
然后:nginx -s reload命令走一下,应该就OK,实在还是不行就百度下原因吧,或者我一样直接重启centos了,
OK,到此,配置完成;感觉写的好像没多繁琐,但小白你搞一下就。。。。心里苦;
然后。。。打开你的putty,一直cd 到你netcore目录下面也就是你用ftp传过来已经发布了的站点文件目录下;
最后执行:dotnet NetCoreDemo.dll,让它跑起来,不跑你直接访问就502了;
OK,至此,我们回到windows上,用我们的浏览器访问centos的IP和80端口,
成功了,有点累,对一个小白来说。。好了,睡觉