Some Memo


Easy Access Memo

rc.local under 20.04

/etc/systemd/system/rc-local.service

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

[Install]
WantedBy=multi-user.target

nano /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0

chmod +x rc.local

systemctl enable rc-local

rc.local under Ubuntu 18.04 Bionic Beaver

ln -fs /lib/systemd/system/rc.local.service /etc/systemd/system/rc.local.service
touch /etc/rc.local
chmod /etc/rc.local

rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0

WordPress redirect loop

In wp-config.php

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
       $_SERVER['HTTPS']='on';

Error while loading shared libraries: libcrypto.so.XX

which openssl | xargs ldd
# If missing
ln -s /usr/local/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1
ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1

Chang file permission (server)

find /path -type f -exec chmod 644 {} \;
find /path -type d -exec chmod 755 {} \;

MySQL password reset

service mysql stop
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
mysql -u root -p
# MySQL 5.7+
mysql(none)>update mysql.user set authentication_string=password('123456') where user='root';
pkill mysql
service mysql start

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注