apeche2部署
1 准备系统环境
应该对操作系统没什么要求,任何发行版的 linux 和 windows 都行,只要可以运行 apache 就可以。我用的是 ubuntu14.04.
2 搭建环境
sudo apt-get install apache2
sudo apt-get install php7.2 libapache2-mod-php7.2 php7.2-curl
wget https://release.larsjung.de/h5ai/h5ai-0.29.0.zip
unzip h5ai-0.29.0.zip
cp -r _h5ai /var/www/html/
apt-get install php5-gd
sudo service apache2 restart
如果出现php安装问题,可以参考
# apt-get update
# apt-get upgrade
# apt-get install
这样就可以正常使用apt-get了~
3 检查是否安装正确
首先会看到登录界面,如下图所示。初始密码为空,可以在 _h5ai/private/conf/options.json 中修改密码
acme.sh --issue -d hufan.me --apache
acme.sh --installcert -d hufan.me
--cert-file /etc/apache2/ssl/cert.pem
--key-file /etc/apache2/ssl/key.pem
--fullchain-file /etc/apache2/ssl/fullchain.pem
--reloadcmd "service apache2 force-reload"
SSLCertificateFile /etc/apache2/ssl/cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/key.pem
SSLCertificateChainFile /etc/apache2/ssl/fullchain.pem
caddy部署(推荐)
我的部署结果:
proxy.hufan.me {
gzip
timeouts none
root /var/www/html
browse
proxy /avewqs 127.0.0.1:38932 {
without /avewqs
websocket
}
}
https://hufan.me {
gzip
root /var/www/html
# 启用php
fastcgi / /run/php/php7.0-fpm.sock php
# Caddy 链接重写规则:
rewrite {
if {path} ends_with /
to {dir}/index.html {dir}/index.php /_h5ai/public/index.php
}
}
# 重定向
http://hufan.me {
timeouts none
redir https://hufan.me
}
import sites/*