caddy + mariadb + php + wordpress

centos 7:
cat /etc/redhat-release
yum update

uname -r
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.0-5.el7.elrepo.noarch.rpm
yum --disablerepo=“*” --enablerepo=“elrepo-kernel” list available
yum --enablerepo=elrepo-kernel install kernel-lt-devel kernel-lt -y
awk -F’ ‘$1=="menuentry " {print $2}’ /etc/grub2.cfg
grub2-set-default 0
reboot
rpm -qa | grep kernel
yum remove kernel

echo “net.core.default_qdisc=fq” >> /etc/sysctl.conf
echo “net.ipv4.tcp_congestion_control=bbr” >> /etc/sysctl.conf
sysctl -p
lsmod | grep bbr

yum install mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql -u root -p
Enter password: //直接回车
CREATE DATABASE wordpress;
CREATE USER ‘wordpressuser’@‘localhost’ IDENTIFIED BY ‘databasepassword’;
GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpressuser’@‘localhost’;
FLUSH PRIVILEGES;
quit;

//如果重做
SHOW DATABASES;
DROP DATABASE wordpress;
drop user ‘wordpressuser’@‘localhost’;

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php74
yum provides php
yum update -y
yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
php -v
vim /etc/php-fpm.d/www.conf
user = caddy
group=caddy
systemctl enable php-fpm.service
systemctl restart php-fpm.service
yum list installed | grep php

yum install yum-plugin-copr
yum copr enable @caddy/caddy
yum install caddy
whereis caddy
cd /etc/caddy
vim Caddyfile
http://xxx.com {
redir https://xxx.com:8443
}
https://xxx.com:8443 {
root * /var/www/html
encode gzip
tls xxx@xmail.com
file_server
php_fastcgi localhost:9000
}

wget https://wordpress.org/latest.zip
unzip latest.zip
cp -rf wordpress/* /var/www/html/
//重做
\cp -a wordpress/* /var/www/html/
cd /var/www/html
cp wp-config-sample.php wp-config.php
vim wp-config.php
/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘wordpress’ );

/** MySQL database username */
define( ‘DB_USER’, ‘wordpressuser’ );

/** MySQL database password */
define( ‘DB_PASSWORD’, ‘databasewordpress’ );

define(“FS_METHOD”, “direct”);

chown -R caddy:caddy /var/www/html
chmod -R 755 /var/www/html
//如果出现问题cannot create directory
chmod -R 777 wp-content

systemctl enable caddy
systemctl restart caddy

//tcp优化
vim /etc/sysctl.conf
fs.file-max=65535
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0

net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_timestamps = 1

net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

net.ipv4.tcp_max_syn_backlog = 262144
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 262144

net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30

net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_mem = 94500000 915000000 927000000

Esc
:wq!
sysctl -p

//swap
https://blog.csdn.net/zstack_org/article/details/53258588

//换ssh port
vim /etc/ssh/sshd_config
port xxx
systemctl restart sshd.service

touch freem.sh
vim freem.sh
#!/bin/bash
echo “start”
sync;sync;sync;
sleep 10
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
echo “end”

chmod +x freem.sh
crontab -e
0 19 * * * freemem.sh
crontab -l
systemctl start crond.service
systemctl enable crond.service
cat /var/log/cron | grep cleanCache

enjoy your life
//非原创
//caddy用8443端口给wordpress建站
//跳转不显示端口号

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值