基本说明
本教程能解决的东西
1, 将本地服务项目部署到万网服务器
2, 可以映射到自己的域名
准备
1, 部署所需要的条件
1, 一个健康的系统; 一般安装之后, 能稳定安装部分软件。win7、ubuntu、centos etc;
2, 安装 git 关于这一点可以看我其他文章; git基础教程;或者是廖雪峰git教程。
3, 有一个基本邮箱; 要求登录github.com 并用之注册
过程
第一步
在github.com 中新建项目 &username.github.io 的项目;
第二步
git clone 到本地
mkdir demo; cd demo; ###[]处填写你的username
git clone githuh.com/[]/[] .github.io/
git ssh-key 的填写
Note: 如果没有进行 ssh key的验证 , 要进行
<span class="hljs-preprocessor">###配置自己的username和emal可以随便填写</span> git config --global user<span class="hljs-preprocessor">.name</span> <span class="hljs-string">"username"</span> git config --global user<span class="hljs-preprocessor">.email</span> <span class="hljs-string">"username@gmail.com"</span> <span class="hljs-preprocessor">###</span> cd ~/<span class="hljs-preprocessor">.ssh</span> <span class="hljs-preprocessor">##如果有; 就直接提取了id_rsa.pub</span> ssh-keygen -t rsa -C <span class="hljs-string">"actanble@126.com"</span> <span class="hljs-preprocessor">#填写你的注册邮箱;这里绑定你的邮箱和本机。</span> <span class="hljs-preprocessor">###生成了两个文件, 把id_rsa.pub的内容放到github.com/settings的setting keys 里面 add ssh-key 即可。</span> <span class="hljs-preprocessor">##测试</span> ssh git@github<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">###配置自己的username和emal可以随便填写</span> git config --global user<span class="hljs-preprocessor">.name</span> <span class="hljs-string">"username"</span> git config --global user<span class="hljs-preprocessor">.email</span> <span class="hljs-string">"username@gmail.com"</span> <span class="hljs-preprocessor">###</span> cd ~/<span class="hljs-preprocessor">.ssh</span> <span class="hljs-preprocessor">##如果有; 就直接提取了id_rsa.pub</span> ssh-keygen -t rsa -C <span class="hljs-string">"actanble@126.com"</span> <span class="hljs-preprocessor">#填写你的注册邮箱;这里绑定你的邮箱和本机。</span> <span class="hljs-preprocessor">###生成了两个文件, 把id_rsa.pub的内容放到github.com/settings的setting keys 里面 add ssh-key 即可。</span> <span class="hljs-preprocessor">##测试</span> ssh git@github<span class="hljs-preprocessor">.com</span>
###配置自己的username和emal可以随便填写 git config --global user.name "username" git config --global user.email "username@gmail.com" ### cd ~/.ssh ##如果有; 就直接提取了id_rsa.pub ssh-keygen -t rsa -C "actanble@126.com" #填写你的注册邮箱;这里绑定你的邮箱和本机。 ###生成了两个文件, 把id_rsa.pub的内容放到github.com/settings的setting keys 里面 add ssh-key 即可。 ##测试 ssh git@github.com
第三步
准备好一个html库模板
找不到的可以在 download.csdn.net 里面搜叫好看的web模板, 自己贴一个到actanble.github.io这个文件夹中。
接着
git init <span class="hljs-preprocessor">#初始化git 仓库;</span> cd actanble<span class="hljs-preprocessor">.github</span><span class="hljs-preprocessor">.io</span> <span class="hljs-preprocessor">#注意 :目前建立主分支, 进入到actanble.githb.io文件夹</span> git <span class="hljs-keyword">add</span> . <span class="hljs-preprocessor">#添加到git 内存处理器</span> git commit -m <span class="hljs-string">"First commit "</span> <span class="hljs-preprocessor">###确认填写</span> <span class="hljs-preprocessor">##这里进行上传push</span> git <span class="hljs-keyword">push</span> <span class="hljs-preprocessor">##要求你输入github的账户名和密码; 输入完成即可。</span>git init <span class="hljs-preprocessor">#初始化git 仓库;</span> cd actanble<span class="hljs-preprocessor">.github</span><span class="hljs-preprocessor">.io</span> <span class="hljs-preprocessor">#注意 :目前建立主分支, 进入到actanble.githb.io文件夹</span> git <span class="hljs-keyword">add</span> . <span class="hljs-preprocessor">#添加到git 内存处理器</span> git commit -m <span class="hljs-string">"First commit "</span> <span class="hljs-preprocessor">###确认填写</span> <span class="hljs-preprocessor">##这里进行上传push</span> git <span class="hljs-keyword">push</span> <span class="hljs-preprocessor">##要求你输入github的账户名和密码; 输入完成即可。</span>
git init #初始化git 仓库; cd actanble.github.io #注意 :目前建立主分支, 进入到actanble.githb.io文件夹 git add . #添加到git 内存处理器 git commit -m "First commit " ###确认填写 ##这里进行上传push git push ##要求你输入github的账户名和密码; 输入完成即可。
第四步
开始准备域名了
因为 你的 username.github.io 已经完成了, 可以在外网进行访问。
域名选择和阿里云应用
这里, 阿里云的账号注册一个, 买一个域名。 几块钱一个;
接着 在cmd中 ping username.github.io 查看IP; 再填写在记录值那一栏。
第五步
在 username.github.io 项目中添加 CNAME文件
CNAME文件中只填写自己的域名即可; 就这样 就可以被 github + jellky 映射到自己的域名了。
结果
你可以进去 访问自己的域名了。
其他说明
本地项目到外网也可以 Nginx+Django+Uwsgi 架构部署;
关于博客也可以用java的博客框架solo + nginx/apache/ 部署。
参考文章
五步教你实现使用Nginx+uWSGI+Django方法部署Django程序
本文参考的内容
后记
有其他内容再补上, 目前就写这么多吧。
原文链接:https://www.cnblogs.com/actanble/p/6713424.html