1.Mariadb无法登录。
Mariadb安装完成初始化之后,命令行下,切换到root账户,mysql -u root -p
登录到数据库,执行以下命令。
update mysql.user set plugin='mysql_native_password' where user='root';
FLUSH PRIVILEGES;
修改认证插件后,就可以使用其他软件连接数据库了。
2.Typecho的问题
开启Https后无法登录,混合页面无法显示,头像无法加载
编辑Typecho根目录下的config.inc.php
,在最下面加上以下代码。
修改默认GRAVATAR头像源
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://sdn.geekzu.org/avatar/');
开启HTTPS
define('__TYPECHO_SECURE__', true);
修改之后可以正常登录了,但是混合页面还是无法显示,,以下配置会开启HTTPS,并重定向80端口到443,开启全站HTTP跳转到HTTPS,访问网站根目录时自动跳转到博客
<VirtualHost *:443>
#SSL
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/amorh.cn/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/amorh.cn/privkey.pem
#SSLProtocol -All +TLSv1 +TLSv1.1 +TLSv1.2
SSLProtocol -All +TLSv1.3
SSLCipherSuite HIGH:!aNULL:!MD5:!3DES
#基本配置
ServerName amorh.cn
ServerAdmin 652605571@qq.com
DocumentRoot /var/www
#重定向到博客文件、文件夹存在时重定向
<Directory /var/www>
#允许跨域
Header set Access-Control-Allow-Origin: "*"
Header set Access-Control-Allow-Methods: "GET,POST,PUT,DELETE,OPTIONS"
Header set Access-Control-Allow-Headers: "Content-Type"
Header set Content-Security-Policy: "upgrade-insecure-requests"
#HTST
#Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ https://amorh.cn/typecho/$1 [R=301,L]
</Directory>
#Typecho重定向
<Directory /var/www/typecho>
RewriteEngine On
RewriteBase /typecho/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /typecho/index.php/$1 [L]
</Directory>
#kodbox配置
<Directory /var/www/kodbox>
AcceptPathInfo On
AllowOverride All
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</Directory>
#h5ai 配置
<Directory /var/www/file>
DirectoryIndex index.html index.php /file/_h5ai/public/index.php
</Directory>
</VirtualHost>
#80端口重定向到HTTPS
<VirtualHost *:80>
ServerName amorh.cn
ServerAdmin 652605571@qq.com
DocumentRoot /var/www
<Directory /var/www>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ https://amorh.cn/$1 [R=301,L]
</Directory>
</VirtualHost>
3 条评论
想想你的文章写的特别好www.jiwenlaw.com
不错不错,我喜欢看 https://www.237fa.com/
不错不错,我喜欢看 https://www.jiwenlaw.com/