Parkomat.io:Linux下自建WebDav、DNS 和 Web服务器

Parkomat.io:Linux下自建WebDav、DNS 和 Web服务器

Parkomat.io,是一个Linux下创建DNS + Web + WebDav的脚本。下面是创建WebDav服务器过程,DNS和web为同样配置文件。

基于Centos 7
1、安装Go 1.8.3
a、下载并安装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/

b、添加环境变量

vi /etc/profile

添加如下内容:

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

c、使配置生效:

source /etc/profile

d、查看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

源码来自:https://github.com/parkomat/parkomat

发表评论