L02※配置网站

3> 更改网站文件的权限

chown -R www.www /data/wwwroot/
find /data/wwwroot/ -type d -exec chmod 775 {} \;
find /data/wwwroot/ -type f -exec chmod 664 {} \;
#!/bin/bash

# 需要操作的文件夹
dir_www="/data/wwwroot/"
dir_jupy="/data/jupyter/"

# 检查wwwroot目录是否存在,如果存在则执行相关操作
if [ -d "$dir_www" ]; then
    chown -R www.www $dir_www
    find $dir_www -type d -exec chmod 775 {} \;
    find $dir_www -type f -exec chmod 664 {} \;
    echo "已完成wwwroot目录操作。"
else
    echo "目录 $dir_www 不存在。"
fi

# 检查jupyter目录是否存在,如果存在则执行相关操作
if [ -d "$dir_jupy" ]; then
    chown -R www.www $dir_jupy
    find $dir_jupy -type d -exec chmod 775 {} \;
    find $dir_jupy -type f -exec chmod 664 {} \;
    echo "已完成jupyter目录操作。"
else
    echo "目录 $dir_jupy 不存在。"
fi

# 清理日志并重启systemd-journald服务
echo "正在清理日志..."
journalctl --vacuum-size=500M
echo "正在重启systemd-journald服务..."
systemctl restart systemd-journald.service
echo "正在验证日志..."
journalctl --verify

echo "所有操作已完成。"

4>[报错]E: Sub-process /usr/bin/dpkg returned an error code

mv /var/lib/dpkg/info     /var/lib/dpkg/info_bak
mkdir /var/lib/dpkg/info
apt-get update && apt-get -f install 
mv /var/lib/dpkg/info/*        /var/lib/dpkg/info_bak/
rm -rf /var/lib/dpkg/info
mv /var/lib/dpkg/info_bak /var/lib/dpkg/info

5> [报错]The CA is processing your order, please just wait. (29/30)

删除~/.acme.sh/文件夹里相应域名的文件夹

~# /.acme.sh/acme.sh  --set-default-ca --server letsencrypt
location ~ /.well-known {
            allow all;
}

6> 清理日志文件

# du -sh .[!.]*  查询隐藏大文件
journalctl --vacuum-size=500M
systemctl restart systemd-journald.service
journalctl --verify

7> 小电脑UBUNTU下kern.log,syslog文件过大

*/3 * * * * echo " " > /var/log/kern.log
*/3 * * * * echo " " > /var/log/syslog

8> wordpress 伪静态

将固定链接设置为自定义,内容为:/%post_id%.html

location /
  {
	 try_files $uri $uri/ /index.php?$args;
  }

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

9> thinkphp 伪静态

location ~* (runtime|application)/{
	return 403;
}
location / {
	if (!-e $request_filename){
		rewrite  ^(.*)$  /index.php?s=$1  last;   break;
	}
}

10> 卸载snap

sudo apt-get purge snapd
sudo apt autoremove --purge snapd

11> 数据库授权

# 添加一个用户名为linux,密码为 123456,授权为% (%表示所有 ip 能连接,可以设置指定 ip)对data数据库所有权限
mysql –uroot –p
MySQL  [(none)]> grant all privileges on data.* to linux@'%' identified by '123456';
MySQL  [(none)]> flush privileges;
MySQL  [(none)]> exit;

1 2 3

© 版权声明
THE END
喜欢就支持一下吧
点赞2 分享