centos7 下部署asp.net core 2.0应用

  • 安装CentOS7
  • 配置网络【可选】
  • 安装.Net core2.0
  • 创建测试Asp.net Core应用程序
  • 正式部署项目

安装VMware->新建虚拟机->找到系统镜像->一步一步往下装,不多说了。。

如果ping baidu.com ping不通, 系统版本可能没有配置网络

博客园有很多CentOs配置网络的文章自己去搜索一下。。

安装.Net core2.0,创建测试Asp.net Core应用程序:

按照官网来就行,不再赘述:

https://www.microsoft.com/net/learn/get-started/linux/rhel#install

正式部署项目:

查看主机IP

使用FTP上传程序包到Linux

打开终端->找到项目根目录->执行 dotnet xxx.web.dll ,这个xxx.web.dll是指你的web应用程序集。

搞定!

使用:IP+端口访问去吧。

部署之Docker

待续....

Windows下部署asp.net core 2.0 之  Kestrel

如果没有运行环境,请去下载: https://www.microsoft.com/net/learn/get-started/windows

打开cmd,使用cd /d c:\xxxpatn 命令 找到发布的项目根目录;运行dotnet xxx.web.dll,这个xxx.web.dll是指你的web应用程序集。

没有问题的话看下面

本地访问:http://localhost:5000

使用Nginx反向代理服务器映射端口到80:

下载:http://nginx.org/en/download.html  安装

配置  \conf\nginx.conf 文件

  1. #user nobody;
  2. worker_processes 1;
  3.  
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;
  7.  
  8. #pid logs/nginx.pid;
  9.  
  10. events {
  11. worker_connections 1024;
  12. }
  13.  
  14. http {
  15. include mime.types;
  16. default_type application/octet-stream;
  17.  
  18. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  19. # '$status $body_bytes_sent "$http_referer" '
  20. # '"$http_user_agent" "$http_x_forwarded_for"';
  21.  
  22. #access_log logs/access.log main;
  23.  
  24. sendfile on;
  25. #tcp_nopush on;
  26.  
  27. #keepalive_timeout 0;
  28. keepalive_timeout 65;
  29.  
  30. #gzip on;
  31. #配置服务器地址,可以有多台,localhost 为 服务名
  32. upstream localhost {
  33. server 127.0.0.1:5000 weight=1;
  34. }
  35.  
  36. server {
           #侦听80端口
  37. listen 80;
           #服务名称必须和upstream后面的名称一致
  38. server_name localhost;
  39.  
  40. #charset koi8-r;
  41.  
  42. #access_log logs/host.access.log main;
  43.  
  44. #location / {
  45. # root html;
  46. # index index.html index.htm;
  47. #}
  48. #指定访问时转发到哪里,localhost为服务名
  49. location / {
  50. proxy_pass http://localhost;
  51. }
  52.  
  53. #error_page 404 /404.html;
  54.  
  55. # redirect server error pages to the static page /50x.html
  56. #
  57. error_page 500 502 503 504 /50x.html;
  58. location = /50x.html {
  59. root html;
  60. }
  61.  
  62. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  63. #
  64. #location ~ \.php$ {
  65. # proxy_pass http://127.0.0.1;
  66. #}
  67.  
  68. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  69. #
  70. #location ~ \.php$ {
  71. # root html;
  72. # fastcgi_pass 127.0.0.1:9000;
  73. # fastcgi_index index.php;
  74. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  75. # include fastcgi_params;
  76. #}
  77.  
  78. # deny access to .htaccess files, if Apache's document root
  79. # concurs with nginx's one
  80. #
  81. #location ~ /\.ht {
  82. # deny all;
  83. #}
  84. }
  85.  
  86. # another virtual host using mix of IP-, name-, and port-based configuration
  87. #
  88. #server {
  89. # listen 8000;
  90. # listen somename:8080;
  91. # server_name somename alias another.alias;
  92.  
  93. # location / {
  94. # root html;
  95. # index index.html index.htm;
  96. # }
  97. #}
  98.  
  99. # HTTPS server
  100. #
  101. #server {
  102. # listen 443 ssl;
  103. # server_name localhost;
  104.  
  105. # ssl_certificate cert.pem;
  106. # ssl_certificate_key cert.key;
  107.  
  108. # ssl_session_cache shared:SSL:1m;
  109. # ssl_session_timeout 5m;
  110.  
  111. # ssl_ciphers HIGH:!aNULL:!MD5;
  112. # ssl_prefer_server_ciphers on;
  113.  
  114. # location / {
  115. # root html;
  116. # index index.html index.htm;
  117. # }
  118. #}
  119.  
  120. }

配置好之后:我们cmd->cd /d Nginx目录->start nginx

访问 http://localhost 搞定!

Nginx其他命令:nginx -s stop 停止

Windows下部署asp.net core 2.0 之  IIS

待续....

Nginx 请求分发

待续....

linux centos7 和 windows下 部署 .net core 2.0 web应用的更多相关文章

  1. Ubuntu 下使用 Nginx 部署 .NET Core 2.0 网站

    前言 本文介绍如何在 Ubuntu 16.04 服务器上安装 .NET Core 2.0 SDK.创建项目与发布,并使用 Nginx 部署 .NET Core 2.0 Web 项目. 安装 .NET ...

  2. Windows下部署ElasticSearch5.0以下版本

    Windows下部署ElasticSearch分ElasticSearch5.0以上版本(包括5.0)和ElasticSearch5.0以下版本两种情况,这两种安装方式有很大不同.今天首先说Elast ...

  3. win10下ASP.NET Core 2.0部署环境搭建(转)

    此文用于记录在win10环境下,新建的Asp.net Core 2.0 Web应用项目如何运行在IIS上 一.运行环境 操作系统: Window10 家庭中文版 版本 10.0.15063 版本 15 ...

  4. windows 下部署 .netcore 到 docker

    前面我们演示了如何将 Asp.Net Core 程序部署到 iis 和 部署到 windows 服务.其实前面的都是铺垫,如何将 Asp.Net Core 站点部署到 docker 才是这个系列文章的 ...

  5. windows 下部署kafka 日记 转

    windows 下部署kafka 日记 转一.下载去apache 的官网(http://kafka.apache.org/downloads.html)下载最新的二进制版的压缩包.目前的最新版本是ka ...

  6. .net core 2.2 部署CentOS7(5)部署.net core mvc

    目录: .net core 2.2 部署CentOS7(1)安装虚拟机 .net core 2.2 部署CentOS7(2)给虚拟机安装CentOS7 .net core 2.2 部署CentOS7( ...

  7. windows 下部署 .netcore 到 windows service

    接上一篇 <windows 下部署 .netcore 到 iis>,这一篇记录一下怎么将 Asp.Net Core 以 windows 服务的方式部署. 一.修改代码 其实也很简单,只要调 ...

  8. QT程序在windows下部署发布

    转载:http://www.cnblogs.com/Fan_Fan/archive/2010/05/29/1746860.html QT程序在windows下部署发布 以下包括了部分网上收集的,以及q ...

  9. 关于在windows下部署发布QT程序的总结

    原文请看:http://www.cnblogs.com/javaexam2/archive/2011/05/18/2632916.html 关于在windows下部署发布QT程序的总结 2008-06 ...

随机推荐

  1. [复现]GXY2019

    前言 当时GXY的时候在复习中,临时抱拂脚,没时间打比赛.就写了一题./(ㄒoㄒ)/~~ babysqli 当时做了写了笔记. 过滤了or,()其中or可以用大小写绕过,可以用order by盲注 第 ...

  2. 常见web漏洞整理之进击吧xss!!!

    XSS在线测试环境: http://xss-quiz.int21h.jp/ https://brutelogic.com.br/xss.php 这两个站对xss的理解很有帮助!!! 参考链接: htt ...

  3. [PHP] excel 的导入导出

    其实excel导入导出挺简单的,导出最简单! 其原理都是把数据读出来,导出是从数据库中读出数据,导入是从文件读出数据! 导出写入文件,导入写入数据库! 但是在导入表的时候,用的是PHPExcel, 不 ...

  4. fasttext的使用,预料格式,调用方法

    数据格式:分词后的句子+\t__label__+标签 fasttext_model.py from fasttext import FastText import numpy as np def ge ...

  5. Python开发基础之Python常用的数据类型

    一.Python介绍 Python是一种动态解释型的编程语言.Python它简单易学.功能强大.支持面向对象.函数式编程,可以在Windows.Linux等多种操作系统上使用,同时Python可以在J ...

  6. nav破解

    https://blog.csdn.net/qq_40529395/article/details/78839357

  7. chcp437 转换英语,在西班牙语系统中无效

    https://social.technet.microsoft.com/Forums/en-US/9c772011-5094-4df0-bf73-7140bf91673b/chcp-command- ...

  8. JNI与NDK简析(一)

    1 JNI 简介 在Android Framework中,需要提供一种媒介或 桥梁,将Java层(上层)与C/C++层(下层)有机的联系起来,使得他们互相协调完成某些任务.而充当这种媒介的就是Java ...

  9. 【Linux网络基础】上网原理流程

    1. 局域网用户上网原理 上网过程说明: 确保物理设备和线路架构准备完毕,并且线路通讯状态良好 终端设备需要获取或配置上局域网(私有地址)地址,作为局域网网络标识 当终端设备想上网时,首先确认访问的地 ...

  10. 搭建vsftpd文件服务器并创建虚拟用户

    一.安装     1. 查看是否安装vsftpd         rpm -qa | grep vsftpd     2. 安装          yum -y install vsftpd      ...