一个懒散的博客

Parkomat:Linux下自建WebDav+DNS+Web服务器教程

简介

Parkomat.io,是一个Linux下创建DNS+Web+WebDav的脚本。当您有很多域名并且通过典型的托管面板进行管理变得太复杂时,Parkomat很有用。下面是创建WebDav服务器过程,DNSweb为同样配置文件。

特征

  • DNS服务器带有全部功能
  • 具有SSL支持的Web服务器(可以在一个IP上运行许多证书)
  • WebDav可轻松上传文件到网页

Github地址:https://github.com/parkomat/parkomat

安装

本安装在Centos 7下测试成功。
1、安装Go 1.8.3
下载并安装Go

wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz --no-check-certificate
tar zxvf go1.8.3.linux-amd64.tar.gz
mv go /usr/local/

添加环境变量

vi /etc/profile

添加如下内容:

export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go

使配置生效:

source /etc/profile

查看Go是否安装成功

go version

2、安装parkomat

go get github.com/parkomat/parkomat

配置文件config.toml/your/parkomat/directory,其中your为放置文件的根目录)(127.0.0.1改为自己的服务器IP)

# if you set it to true, Parkomat will serve any domain pointing at it
catch_all = true

[[domains]]
name = "example.domain"

[[domains]]
name = "parkomat.io"
    # supports per domain zone settings
    [domains.zone]
    A = "192.168.0.1"
    MX = """
1 better.mail.server
"""
    TXT = """
hello world
"""

# each domain will use following zone settings
[zone]
# for both .domain and www.domain
A = "127.0.0.1"
MX = '''
1 test1.mail.server
10 test2.mail.server
'''

[web]
ip = "127.0.0.1"
port = 80
path = "./www"

# make sure that path exists
# for example issue mkdir -p /var/log/parkomat
access_log = "/var/log/parkomat/access.log"

[webdav]
enabled = true
username = "hello"
password = "world"
# your share will be under http://example.domain/dav/
mount = "/dav/"

[dns]
ip = "127.0.0.1"
port = 53

# details of dns servers for NS record
[[dns.servers]]
name = "ns1.parkomat.co"
ip = "127.0.0.1"

[[dns.servers]]
name = "ns2.parkomat.co"
ip = "127.0.0.1"

./web目录

.
├── default
│   └── public_html
│       └── index.html
├── parkomat.io
|   ├── parkomat.io.crt
|   ├── parkomat.io.key
|   └── public_html
|       └── index.html
└── config.toml

要添加新域名,只需创建具有该域名的新目录。如果你想使用SSL,只需复制domain.crtdomain.key文件复制到该域目录(注意不要将它们上传到public_html目录)。您需要重新启动parkomat

更多详情请看Github项目地址

赞(0)