Apache开启浏览器缓存、开启gizp


ExpiresActive On
ExpiresDefault "access plus 12 month"
ExpiresByType text/html "access plus 12 months"
ExpiresByType text/css "access plus 12 months"
ExpiresByType image/gif "access plus 12 months"
ExpiresByType image/jpeg "access plus 12 months"
ExpiresByType image/jpg "access plus 12 months"
ExpiresByType image/png "access plus 12 months"
EXpiresByType application/x-shockwave-flash "access plus 12 months"
EXpiresByType application/x-javascript "access plus 12 months"
ExpiresByType video/x-flv "access plus 12 months"

 

辅助:需要加载

a2enmod expires

a2enmod headers

说明

开启gzip

LoadModule expires_module modules/mod_expires.so
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE text/html

数据库备份脚本

#!/bin/bash
DATA_DIR=/var/lib/mysql
BACK_DIR=/backup/mysql
date=`date +%Y%m%d`
deldate=`date -d -7day +%Y%m%d`
rm -f $BACK_DIR/mysql-$deldate.tar.gz
service mysqld stop
tar -zcf $BACK_DIR/mysql-$date.tar.gz $DATA_DIR
echo $date " mysql backup success" >> /root/mysqlbackup.log
service mysqld start

 

网站程序目录备份脚本

#!/bin/bash
DATA_DIR=/var/www
BACK_DIR=/backup/html
date=`date +%Y%m%d`
deldate=`date -d -7day +%Y%m%d`
rm -f $BACK_DIR/www-$deldate.tar.gz
service httpd stop
service mysqld stop
tar -zcf $BACK_DIR/www-$date.tar.gz $DATA_DIR
echo $date " html backup success" >> /root/htmlbackup.log
service mysqld start
service httpd start

 

防火墙脚本

#!/bin/bash
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT

#ssh accept all
#iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#ssh accept 192.168.1.180
iptables -A INPUT -s 192.168.1.180 -p tcp --dport 22 -j ACCEPT
#web
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#ping
#iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -s 192.168.1.180 -p icmp -j ACCEPT
#allow loopback
iptables -A INPUT -i lo -p all -j ACCEPT
#deny
iptables -A OUTPUT -p tcp --sport 31337 -j DROP
iptables -A INPUT -p tcp --dport 31337 -j DROP