YUM源配置 & 更新
yum -y install epel-release
yum -y install yum-utils
yum update
Apache安裝
yum -y install httpd
systemctl enable httpd
systemctl start httpd
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
# 隱藏版本號
vim /etc/httpd/conf.d/secure.conf
TraceEnable off
ServerSignature Off
ServerTokens Prod
# 配置vhost
vim /etc/httpd/conf.d/vhosts.conf
DocumentRoot "/var/www/html"
ServerName example.com
ServerAlias www.example.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" combined
# HTTPS證書安裝
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
yum install certbot python2-certbot-apache
certbot --apache
systemctl restart httpd
MySQL8安裝
# 安裝MySQL8 YUM源
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server
systemctl enable mysqld
systemctl start mysqld
# 查看自動生成的MySQL密碼
grep "password" /var/log/mysqld.log
# 登錄MySQL后修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密碼';
# 刷新MySQL權(quán)限表
FLUSH PRIVILEGES;
PHP7.3安裝
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73
yum -y 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-opcache php-redis php-soap
# 隱藏php版本號
vim /etc/php.ini
expose_php = off
系統(tǒng)參數(shù)設(shè)置
# 文件打開數(shù)設(shè)置
ulimit -n 65535
vim /etc/security/limits.d/nofile.conf
* soft nofile 65535
* hard nofile 65535
# 內(nèi)核網(wǎng)絡(luò)優(yōu)化
vim /etc/sysctl.conf
# 啟用timewait 快速回收
net.ipv4.tcp_tw_recycle = 1