如何在CentOS 7上安装Mailtrain新闻通讯应用程序
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
Firefox Sync是浏览器同步功能,可让您在所有设备上共享数据和首选项(例如书签,历史记录,密码,打开的选项卡和已安装的附件)。Mozilla还为希望托管自己的同步数据的用户和企业提供了与Firefox Sync一起使用的“同步服务器”应用程序。本文向您展示了如何设置Mozilla Sync Server。
更新系统:
sudo yum check-update
要构建和运行Sync Server,您需要安装以下软件包:
Mecurial
sqlite3
git
Python 2.6.6
Python 2.6.6 virtualenv
Python 2.6.6 SetupTools
Python 2.6.6 Developer Tools
安装最新版本的Mercurial:
sudo yum install mercurial
安装所需的开发工具和库:
yum groupinstall 'Development Tools' 'Development Libraries'
yum install tk-devel libjpeg-devel mysql-devel python-devel httpd-devel zlib-devel bzip2-devel
安装SQLite3:
sudo yum install sqlite
安装并构建Python 2.6.6:
cd $home
sudo wget http://python.org/ftp/python/2.6.6/Python-2.6.6.tgz
sudo tar xzvf Python-2.6.6.tgz
cd $home/Python-2.6.6
sudo ./configure --prefix=/opt/python2.6 --enable-thread --enable-shared --enable-unicode=ucs4
sudo make
sudo make install
我们将克隆同步服务器的Git存储库,然后输入文件夹:
git clone https://github.com/mozilla-services/syncserver
cd syncserver
运行build命令,该命令将下载依赖项并编译代码:
make build
启动同步服务器并验证其是否正常运行:
bin/paster serve development.ini
您将看到如下内容:
Starting server in PID 5952.
serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
同步服务器的配置非常简单,只需在配置文件(./syncserver.ini
)中更改几个参数即可。
使用您喜欢的文本编辑器打开配置文件(例如nano ./syncserver.ini
)。
[server:main]
use = egg:gunicorn
host = 0.0.0.0
port = 5000
workers = 1
timeout = 30
[app:main]
use = egg:syncserver
[syncserver]
# This must be edited to point to the public URL of your server,
# i.e. the URL as seen by Firefox.
public_url = http://localhost:5000/
# This defines the database in which to store all server data.
#sqluri = sqlite:////tmp/syncserver.db
# This is a secret key used for signing authentication tokens.
# It should be long and randomly-generated.
# The following command will give a suitable value on *nix systems:
#
# head -c 20 /dev/urandom | sha1sum
#
# If not specified then the server will generate a temporary one at startup.
#secret = INSERT_SECRET_KEY_HERE
# Set this to "false" to disable new-user signups on the server.
# Only request by existing accounts will be honoured.
# allow_new_users = false
# Set this to "true" to work around a mismatch between public_url and
# the application URL as seen by python, which can happen in certain reverse-
# proxy hosting setups. It will overwrite the WSGI environ dict with the
# details from public_url. This could have security implications if e.g.
# you tell the app that it's on HTTPS but it's really on HTTP, so it should
# only be used as a last resort and after careful checking of server config.
force_wsgi_environ = false
[browserid]
# Uncomment and edit the following to use a local BrowserID verifier
# rather than posting assertions to the mozilla-hosted verifier.
# Audiences should be set to your public_url without a trailing slash.
#backend = tokenserver.verifiers.LocalVerifier
#audiences = https://localhost:5000
# By default, syncserver will accept identity assertions issues by
# any server. You can restrict this by setting the below to a list
# of allowed issuer domains.
#allowed_issuers = www.mysite.com myfriendsdomain.org
您的服务器地址必须通过参数指定public_url
:
public_url = http://fsync.example.com
注:默认值public_url
,http://localhost:5000/
会为你的本地计算机上测试的目的工作。
我们将取消注释该sqluri
选项,并放置位置或URI
,该位置将允许服务器连接数据库并存储其信息:
sqluri = sqlite:////path/to/database/file.db
如果要使用其他类型的数据库:
sqluri = pymysql://username:[email protected]/sync
对于该secret
参数,我们将必须为身份验证令牌生成一个秘密密钥:
head -c 20 /dev/urandom | sha1sum
取消注释secret参数的行,然后将返回的字符串复制/粘贴到secret参数中:
secret = db8a203aed5fe3e4594d4b75990acb76242efd35
注意:如果未在此参数中放置任何内容,则服务器将生成一个,但每次重新启动服务器时,它都会有所不同。
取消注释该allow\_new\_users
参数并将其设置为true
允许我们的帐户首次连接到我们的服务器:
allow_new_users = true
然后,我们将取消注释该audiences
参数,并将与该public_uri
参数相同的内容放入其中:
audiences = http://fsync.example.com
最后,只需将以下行添加到文件末尾:
forwarded_allow_ips = *
此行将帮助您避免错误消息和授权问题。
要启动同步服务器,可以使用以下命令之一:
./path/to/syncserver/local/bin/gunicorn --threads 4 --paste /path/to/syncserver/syncserver.ini &
这使您可以选择配置文件的位置。以及放置参数--threads 4
,该参数允许为同步服务器分配更多功能。
要在每次实例启动时启动服务器,可以通过键入以下crontab -e
命令将以下行添加到crontab中:
@reboot ./path/to/syncserver/local/bin/gunicorn --paste /path/to/syncserver/syncserver.ini &
您可以使用与该WSGI
协议兼容的其他Web服务器。例如:
Nginx
与uWSGI。Apache
与mod_wsgi结合。对于Nginx,您必须使用Nginx的内置代理,如下所示:
server {
listen 80;
server_name fsync.example.com;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_read_timeout 120;
proxy_connect_timeout 10;
proxy_pass http://127.0.0.1:5000/;
}
}
Nginx用户可能仅使用WSGI套接字。
uWSGI
通过Pip 安装:
pip install uwsgi
uWSGI
通过下载源压缩包进行安装:
wget https://projects.unbit.it/downloads/uwsgi-latest.tar.gz
tar zxvf uwsgi-latest.tar.gz
cd <dir>
make
注意:构建后,uwsgi
当前目录中将有一个二进制文件。
安装后,请使用以下选项启动它:
uwsgi --plugins python27 --manage-script-name \
--mount /<location>=/path/to/syncserver/syncserver.wsgi \
--socket /path/to/uwsgi.sock
然后使用以下Nginx配置:
location /<location>/ {
include uwsgi_params;
uwsgi_pass unix:/path/to/uwsgi.sock;
}
安装mod_wsgi
:
apt-get install libapache2-mod-wsgi
然后使用以下虚拟主机:
<VirtualHost *:80>
ServerName sync.example.com
DocumentRoot /path/to/syncserver
WSGIProcessGroup sync
WSGIDaemonProcess sync user=sync group=sync processes=2 threads=25 python-path=/path/to/syncserver/local/lib/python2.7/site-packages/
WSGIPassAuthorization On
WSGIScriptAlias / /path/to/syncserver/syncserver.wsgi
CustomLog /var/log/apache2/sync.example.com-access.log combined
ErrorLog /var/log/apache2/sync.example.com-error.log
</VirtualHost>
安装并配置服务器后,您可以配置桌面Firefox客户端与新的Sync Server通信。开始之前,如果您已经连接到Firefox Sync Server,则必须注销。否则,可能无法连接到新服务器。
首先,打开一个新标签并输入以下地址:
about:config
在搜索栏中,输入identity.sync.tokenserver.uri
其值并将其值更改为服务器URL,路径为token/1.0/sync/1.5
:
http://sync.example.com/token/1.0/sync/1.5
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
快速学习如何在Ubuntu 16.04上安装OpenSIPS控制面板,为VoIP提供商提供支持的功能。
学习如何在Fedora 28上安装Akaunting,一款适合小型企业和自由职业者的开源会计软件。
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
了解導致Minecraft延遲的原因和解決方案,包括優化伺服器性能和減少滯後的步驟。
勒索軟件攻擊呈上升趨勢,但人工智能能否幫助應對最新的計算機病毒?AI 是答案嗎?在這裡閱讀知道是 AI 布恩還是禍根
ReactOS,一個開源和免費的操作系統,這裡有最新版本。它能否滿足現代 Windows 用戶的需求並打倒微軟?讓我們更多地了解這種老式但更新的操作系統體驗。
Whatsapp 終於為 Mac 和 Windows 用戶推出了桌面應用程序。現在您可以輕鬆地從 Windows 或 Mac 訪問 Whatsapp。適用於 Windows 8+ 和 Mac OS 10.9+
閱讀本文以了解人工智能如何在小型公司中變得流行,以及它如何增加使它們成長並為競爭對手提供優勢的可能性。
最近,Apple 發布了 macOS Catalina 10.15.4 補充更新以修復問題,但似乎該更新引起了更多問題,導致 mac 機器變磚。閱讀這篇文章以了解更多信息