安装 PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Apache #apt -y install software-properties-common apt-transport-https lsb-release ca-certificates #add-apt-repository ppa:ondrej/php #apt update sudo apt install php7.4 php7.4-simplexml php7.4-zip libapache2-mod-php7.4 php7.4-curl php7.4-gd \ php7.4-mysql php7.4-intl php7.4-pdo php7.4-mbstring php7.4-imap -y sudo apt install apache2 sudo chown -R www-data: /var/www/xxx sudo a2enmod rewrite systemctl restart apache2 # sudo ufw allow 'Apache Full' # Nginx sudo apt install php-fpm systemctl status php7.4-fpm |
安装MariaDB
1 2 3 4 5 |
sudo apt install mariadb-server sudo mysql_secure_installation CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT permission_type ON database.table TO 'username'@'localhost'; |
1、unknown collation ‘utf8mb4_0900_ai_ci’ mariadb
1 |
sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' xxx.sql |
2、Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.
1 2 |
ALTER TABLE tablexxx ROW_FORMAT=DYNAMIC; sed -i 's/ROW_FORMAT=COMPACT/ROW_FORMAT=DYNAMIC/g' xxx.sql |
MySQL
1 2 3 4 5 6 |
apt-get install mysql-server systemctl status mysql cat /etc/mysql/debian.cnf # 查看默认密码 # sudo mysql_secure_installation create user 'admin'@'localhost' identified by 'admin'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin' |
Let’s Encrypt
1 2 3 4 5 6 7 |
# sudo apt install snapd sudo snap install core; sudo snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot sudo certbot --apache # sudo certbot renew --dry-run |
PrestaShop
- It looks like we have trouble connecting to Addons. Please refresh the page or check your firewall configuration.
12# modules/ps_mbo/src/ExternalContentProvider/ExternalContentProvider.phpconst TIMEOUT_SECONDS = 0.6; # 把这里的值调大一点,如20 - Error: ERR_TOO_MANY_REDIRECTS
登入后台Configure > Shop Parameters > General,开启SSL和SSL on all pages选项。 - Attempted to call function “mb_split” from the global namespace.
1sudo apt-get install php7.4-mbstring
Nginx
1 2 3 4 5 6 7 |
sudo apt-get install nginx # sudo vi /etc/nginx/nginx.conf worker_connections 20000; # 打开注释,隐藏版本 server_tokens off; # 默认页面/usr/share/nginx/html/index.html |
Redis
1 2 3 4 5 6 7 8 |
sudo apt install redis-server # sudo vi /etc/redis/redis.conf supervised systemd bind 127.0.0.1 ::1 # requirepass foobared sudo systemctl restart redis.service |
shell权限限制
1 2 3 4 5 6 7 8 9 10 11 |
# 本方法防不了高手 chsh -s /bin/rbash <username> sudo mkdir /home/<username>/bin sudo chmod 755 /home/<username>/bin echo "PATH=$HOME/bin" >> /home/<username>/.bash_profile echo "export PATH" >> /home/<username>/.bash_profile sudo ln -s /bin/<command> /home/<username>/bin/ chattr +i /home/<username>/.bash_profile # 其它方案:command="only cal cowsay factor figlet fortune" ssh-rsa AAABBBCC.... # https://github.com/ghantoos/lshell |
常用命令
1 2 3 |
user add xxx passwd xxx sed -i '/^root.*ALL=(ALL).*ALL/a\xxx\tALL=(ALL) \tALL' /etc/sudoers |
历史内容
使用设备公钥登录
1 2 3 4 |
# 本地机器 cat ~/.ssh/id_rsa.pub # 服务器 vi ~/.ssh/authorized_keys |
关闭防火墙
1 |
sudo ufw disable |
1 |
安装 ssh |
1 2 3 |
sudo apt-get install openssh-server #文件传输 sudo apt-get install lrzsz |
更新安装源
1 2 3 4 5 |
#安装源地址:http://www.cnblogs.com/ccdc/p/4428555.html sudo vi /etc/apt/sources.list cd /etc/apt/ sudo apt-get update sudo apt-get dist-upgrade |
小技巧
vi下sp, vsp打开新文件进行水平或垂直分屏显示