TODAY=`date +%Y-%m-%d`
tar cvfz /tmp/all-in-one.tar.gz myfirewall database_backup.sh iptables-DROP-jp.zone .ssh/ /etc/php.ini /etc/php-fpm.d/www.conf /etc/nginx/default.d/php.conf /tmp/onlinetv4-2022-11-03.sql-${TODAY}.sql /tmp/onlinetv4-routines-${TODAY}.sql /usr/share/nginx/html/ /etc/nginx/nginx.conf
scp /tmp/all-in-one.tar.gz tr3m:/tmp/
yum list installed > /tmp/yum-installed-tr3.txt
scp /tmp/yum-installed-tr3.txt tr3m:/tmp/
setenforce 0
getenforce
vim /etc/selinux/config #disabled
- vi /etc/ssh/sshd_config
22->22000
#!/bin/bash
# ctalk2
# iptables 样例设置脚本
#
# 清除 iptables 内一切现存的规则
#
iptables -F
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
#
# 容让 SSH 连接到 tcp 端口 22
# 当通过 SSH 远程连接到服务器,你必须这样做才能群免被封锁于系统外
#
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 22000 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp --dport 8081 -j ACCEPT
iptables -A INPUT -p tcp --dport 8443 -j ACCEPT
#
# 设置 INPUT、FORWARD、及 OUTPUT 链的缺省政策
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# 设置 localhost 的访问权
#
iptables -A INPUT -i lo -j ACCEPT
#
# 接纳属于现存及相关连接的封包
#
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# 存储设置
#
/sbin/service iptables save
#
# 列出规则
#
iptables -L -v
sh ~/myfirewall
Host tr3m # tr3 Mirror 222.186.10.219
HostName 103.56.61.67
User root
Port 22000
yum install epel-release
yum install git iptables-services memcached mlocate mariadb-server nginx ntp rsync wget
yum install php php-cli php-common php-fpm php-mbstring php-mysql php-pdo php-pear php-pecl-igbinary php-pecl-memcache php-pecl-memcached php-process php-xml php-gd
/etc/my.cnf.d/server.cnf
[mariadb]
character-set-server = utf8mb4
/etc/my.cnf.d/client.cnf
[client-mariadb]
default-character-set = utf8mb4
sudo systemctl enable mariadb
sudo systemctl restart mariadb
mysql_secure_installation
# root / Ilovetv0127)!@&
create database and user
create database onlinetv4 CHARACTER SET = utf8mb4;
create user 'skytv'@'%' identified by 'Ilovetv0127)!@&';
GRANT ALL ON onlinetv4.* TO 'skytv'@'%';
FLUSH PRIVILEGES;
restore
mysql -u skytv -p onlinetv4 < tmp/onlinetv4-2022-11-03.sql
mysql -u skytv -p onlinetv4 < tmp/onlinetv4-routines-2022-11-03.sql
pear channel-discover pear.apache.org/log4php
pear install log4php/Apache_log4php
## or ##
rsync --delete -avz --exclude '.svn' --exclude 'target' -e ssh /usr/share/pear/log4php tr3m:/usr/share/pear/
/etc/php.ini
cgi.fix_pathinfo=0
/etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
systemctl enable php-fpm
systemctl restart php-fpm
chown -R nginx:nginx /var/lib/php/session
/etc/nginx/default.d/php.conf
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
/etc/nginx/nginx.conf
cd /tmp/
mv usr/share/nginx/html/config /usr/share/nginx/html/
mv usr/share/nginx/html/onlinesite_skytv365 /usr/share/nginx/html/
mv usr/share/nginx/html/sysadmin /usr/share/nginx/html/
systemctl enable nginx
systemctl restart nginx
systemctl enable memcached
systemctl restart memcached
systemctl enable ntpd
systemctl restart ntpd
systemctl enable crond
systemctl restart crond
15 5 * * * /root/database_backup.sh
- curl http://localhost:8080/sysadmin/test.php
- curl http://103.56.61.67:8080/sysadmin/test.php
includes/share.php
error_reporting(0); //E_ALL
ini_set('display_errors', '0'); //On