安装Standard File server
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install ruby
rvm use ruby
gem install bundler --no-document
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
gem install passenger
yum install mysql-devel
git clone https://github.com/standardfile/ruby-server.git
cd ruby-server
bundle install
bower install
rails assets:precompile
RAILS_ENV=production
SECRET_KEY_BASE=[运行"bundle exec rake secret",然后填入值]
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=standard_file
DB_USERNAME=root
DB_PASSWORD=
SALT_PSEUDO_NONCE=[运行"bundle exec rake secret",然后填入值]
rake db:migrate RAILS_ENV=production
passenger start --daemonize -e production --address 127.0.0.1 --port 12345
https://note.example.com {
gzip
tls /etc/ssl/caddy/note.example.com.crt /etc/ssl/caddy/private.key {
curves p521 p384 X25519 p256
}
header / {
X-Content-Type-Options nosniff
X-Frame-Options "SAMEORIGIN"
X-XSS-Protection "1; mode=block"
X-Robots-Tag none
X-Download-Options noopen
X-Permitted-Cross-Domain-Policies none
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
}
proxy / 127.0.0.1:12345 {
transparent
}
}
/usr/local/bin/caddy -conf /etc/caddy/Caddyfile -quic &
- 编辑
/etc/rc.local
,添加Passenger
到自启动
cd /path/to/standardnote && passenger start --daemonize -e production --address 127.0.0.1 --port 12345
Standard Notes连接到自建服务器
- 启动
Standard Notes
,先点击Register
,选Advanced Options
,里面填上上面的服务器地址https://note.example.com
- done