工具相关

阿里云ECS+wordpress构建个人网站

很多程序员都有写博客的习惯,市面上也有不少写博客的网站,csdn,博客园,简书之类的,但作为程序员有个人博客网站应该是一件更酷的事情,过去一周花了点时间搭了个个人网站,整体流程大概介绍下。

服务器申请

第一步我们肯定得有个自己的服务器,国内的直接用阿里云就很合适,到阿里云官网注册个账号,选择云服务器ECS,也可以选择轻量应用服务器,二者差别在于云服务器基本是可空壳操作系统,你可以在上面任意鼓捣,而轻量应用服务器可以选择一些镜像(wordpress个人博客镜像之类的),可以免去不少安装流程,对于没有编程经验的可以选择轻量应用服务器,看知乎上有篇介绍挺详细,可以参考,这里重点将如何用ECS搭建个人博客。

然后我们来讲讲如何选择配置,对于个人博客这种轻应用来说配置不需要太高,当然土豪随意

比如我选购的突发性性能t5

1、地址就近选就行,我身在福建所以选华东(杭州)

2、cpu和内存这块 对于博客这种轻应用(日访问量1000左右吧)来说1G内存 1个CPU就够了,后面你的博客大火之后可以再来加cpu,内存,扩展配置

3、操作系统选centos

4、硬盘这块大家根据自己喜好,大部分应该都默认40G打底。

5、带宽根据流量还是固定带宽大家根据自己喜好来选

6、购买时长,正常购买时长越久越优惠,我就默认买了1年,后面再来续费。

完成配置后各种下一步(包括设置登录密码)付完款之后在阿里云个人账号的控制台就能看到公网ip

环境配置

从阿里云购买完服务器之后拿到ip我们就算有自己的服务器了,接下去就要对这台服务器进行一些环境的配置,配置其实挺简单,第一步我们先连接上服务区做操作,这个时候需要一些命令行工具,mac自带的Terminal就可以用,windows也有对应工具,阿里云个人控制台也有相关工具

这里我以mac自带的Terminal工具为例

命令行输入 ssh root@公网ip地址 输入密码即可进入,然后就开始各种环境安装了,先装一些基本命令

yum install vim
yum install git
yum install unzip
yum install screen
yum install gcc
yum install wget

然后就是装LNMP,lnmp就是后续安装wordpress的预环境,全称是linux+nginx+mysql+php的缩写,参考官网安装就行,整个过程1小时以内应该可以完成

screen -S lnmp
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp

用以上两行命令即可,第二个命令里面的lnmp版本号会随着官网更新而更新,大家跟着官网里的命令来就行,这期间会选择mysql版本,php版本,还有数据库的用户名和密码,这两个信息要记住后面有需要用到。

大概几十分钟后

代表安装成功了,如果安装失败可以根据log去查查资料,我安装倒是很顺利一路下来没有遇到太多问题。

安装成功后,在浏览器直接输入ip地址就可以看到刚刚安装的lnmp

在这里我有遇到一个小问题,安装成功输入ip之后确是404,后来一查原因在得给ecs服务器开通http访问功能,进入控制台的安全组,在ecs实例旁的配置规则,手动增加一条访问规则,协议类型选择全部,端口范围-1/-1,授权对象0.0.0.0/0

这样就可以愉快地用http://ip地址 访问了。

WordPress安装配置

在刚刚的服务器命令行上下载wordpress安装包并解压

wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

接下来会做一些文件复制操作相关的,如果你熟悉linux命令直接用命令行操作也行,我这里选择下载一个图形界面工具来处理FileZilla,用这个工具直接连接服务器

把刚刚解压出来的wordpress目录下的内容(注意不包含wordpress这个文件及)拷贝到var/www下

然后修改wp-config-sample.php文件复制一份为wp-config.php,将里面的数据库配置成刚刚自己搭环境输入的数据库用户名和数据库密码。

数据库配置完之后记得修改下目录权限

chown -R www:www /var/www

最后还要去配置nginx下

进入/usr/local/nginx/conf/nginx.conf

第67行修改服务器ip为刚刚申请的ip地址,69行修改放wordpress的目录 /var/www,

其中server_name在申请完域名绑定了ip之后可以直接修改为域名

接下来再次输入ip地址将访问到wordpress的页面,然后就可以自由得安装一些外挂,主题,插件之类的来修改网站风格,最重要的是可以开始写博客了。

域名申请

再完成上面步骤之后,我们还要给ip地址对应地申请一个域名用来绑定ip地址,这样每次访问就不用靠输入ip了,依然是在阿里云域名官网

选择自己喜欢的域名注册即可。

网站备案

最后就是备案,将ip和域名绑定并做个备案,备案的时间会花1-2个礼拜吧,里面需要填一些资料,身份证上传,其中网站介绍里不能出现个人姓名相关的信息,我初次注册就是因为这个没过又第二次申请了。

整个利用阿里云ecs制作个人博客网站的操作大体如上,用这样一篇文章开启自己的个人博客也算是应景,后续也需会慢慢把以前在csdn写的博客迁移到这里来。

Tagged

About chenzujie

非著名码农一枚,认真工作,快乐生活
View all posts by chenzujie →

47 thoughts on “阿里云ECS+wordpress构建个人网站

  1. Happy New Year Greetings, Cards, gif, Quotes, Free Pictures, Wallpapers, Funny World Memes, Messages, SMS for Lovers, Girlfriend, Boyfriend. Dusty Pattie Even

  2. I was wondering if you ever considered changing the layout of your website?
    Its very well written; I love what youve got to say.

    But maybe you could a little more in the way of content so people could connect with it better.

    Youve got an awful lot of text for only having one or 2 pictures.
    Maybe you could space it out better?

  3. Hello, Neat post. There is an issue together with your site in web explorer, would check this?
    IE nonetheless is the market leader and a large element of
    people will omit your magnificent writing due to this problem.

  4. Today, while I was at work, my sister stole my apple ipad and tested to see if
    it can survive a twenty five foot drop, just so she can be a
    youtube sensation. My apple ipad is now broken and she
    has 83 views. I know this is entirely off topic but I had to share it with someone!

  5. My relatives all the time say that I am wasting my time here at net, however I know I am getting familiarity daily by reading such nice articles or reviews.| Jeniffer Eustace Raimundo

  6. Hiya, I am really glad I have found this info. Today bloggers publish only about gossip and net stuff and this is actually frustrating. A good web site with interesting content, this is what I need. Thank you for making this website, and I will be visiting again. Do you do newsletters by email? Felicia Derek Inessa

  7. This is really attention-grabbing, You are an overly professional blogger.
    I’ve joined your rss feed and sit up for in quest of more of your excellent post.
    Additionally, I have shared your web site in my social networks

  8. Having read this I believed it was extremely enlightening.
    I appreciate you spending some time and effort to put this article together.
    I once again find myself personally spending a significant amount of time both reading and commenting.
    But so what, it was still worth it!

  9. certainly like your web site however you need to take a look at the spelling on several of
    your posts. Many of them are rife with spelling problems and I in finding it very troublesome to tell the
    reality however I’ll certainly come back again.

  10. I am curious to find out what blog system you happen to be utilizing?
    I’m having some minor security problems with my latest site and I would like to find something more safeguarded.

    Do you have any solutions?

发表评论

电子邮件地址不会被公开。