搭建开源java博客并通过域名访问

这个博客系统是王爵在GitHub上开源的,通过简单几步就可以部署成功。
前面几步可以参照如下几个链接:
1、https://www.qcloud.com/community/article/290084001488247673?fromSource=gwzcw.59375.59375.59375
2、https://github.com/otale/tale/wiki
3、https://www.legic.xyz/article/33
当完成博客安装之后,如果想要访问起来酷一点,可在腾讯云上购买一个域名,之后将域名解析到服务器的公网IP地址。tale的默认端口是9000,每次访问都要在IP地址后面加上":9000"。这样是不是很麻烦呢?而且通过域名访问也需要加上端口号,如此一来就不怎么酷了。嗯,解决方法如下:
1、在服务器上下载一个nginx:

sudo apt-get install nginx

2、修改nginx的default设置:

sudo vim /etc/nginx/sites-available/default

注释掉其中的某几行,在"location /"中添加一行,示例如下:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

#root /usr/share/nginx/html;
#index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    #try_files $uri $uri/ =404;
    proxy_pass http://0.0.0.0:9000;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}

}

在这里添加的"proxy_pass http://0.0.0.0:9000;"中的IP地址和端口号可通过这句命令来查询:

netstat -ntlp | grep LISTEN

3、保存并退出,然后重启nginx即可:

sudo service nginx restart


参考资料:
1、https://github.com/otale/tale/wiki
2、https://www.qcloud.com/community/article/290084001488247673?fromSource=gwzcw.59375.59375.59375
3、https://www.legic.xyz/article/33
4、http://www.cnblogs.com/leo-li-3046/p/5690599.html
5、https://q.cnblogs.com/q/60445/

原文地址:https://www.cnblogs.com/liushengchieh/p/7089938.html