準備告別csdn,加入博客園。因此把域名也指向到博客園本身的頁面上了,兩個思路:css
一、借用github的倉庫起轉發html
在github上,創建一個倉庫jared73.github.iolinux
倉庫裏建兩個文件CNAME,裏面輸入www.jared73.comnginx
還有index.html,裏面輸入c++
<script>git
window.location.href="http://www.cnblogs.com/study73"github
</script>正則表達式
而後阿里雲www和@使用cname,域名寫jared73.github.io,而後就ok算法
訪問個人域名,就能夠跳轉到博客園。sql
二、使用本身的服務器,掛載nginx,轉發到博客園本身的頁面
a、首先須要安裝nginx,咱們先安裝相關依賴
gcc 安裝
安裝 nginx 須要先將官網下載的源碼進行編譯,編譯依賴 gcc 環境,若是沒有 gcc 環境,則須要安裝:
yum install gcc-c++
PCRE pcre-devel 安裝
PCRE(Perl Compatible Regular Expressions) 是一個Perl庫,包括 perl 兼容的正則表達式庫。nginx 的 http 模塊使用 pcre 來解析正則表達式,因此須要在 linux 上安裝 pcre 庫,pcre-devel 是使用 pcre 開發的一個二次開發庫。nginx也須要此庫。命令:
yum install -y pcre pcre-devel
zlib 安裝
zlib 庫提供了不少種壓縮和解壓縮的方式, nginx 使用 zlib 對 http 包的內容進行 gzip ,因此須要在 Centos 上安裝 zlib 庫。
yum install -y zlib zlib-devel
OpenSSL 安裝
OpenSSL 是一個強大的安全套接字層密碼庫,囊括主要的密碼算法、經常使用的密鑰和證書封裝管理功能及 SSL 協議,並提供豐富的應用程序供測試或其它目的使用。
nginx 不只支持 http 協議,還支持 https(即在ssl協議上傳輸http),因此須要在 Centos 安裝 OpenSSL 庫。
yum install -y openssl openssl-devel
b、wget下載配置nginx
wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
tar -zxvf nginx-1.10.1.tar.gz
cd nginx-1.10.1
./configure
make && make install
查找安裝路徑:
whereis nginx
cd /usr/local/nginx/sbin/ ./nginx ./nginx -s stop ./nginx -s quit ./nginx -s reload
配置在conf下
location / {
root html;
index index.html index.htm;
proxy_pass http://www.cnblogs.com/study73;
}
location ~ .*\.(js|css|aspx)?$
{
proxy_pass http://www.cnblogs.com;
}
重啓下nginx就ok
最終達到下面的效果: