In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Use Shell script to optimize Apache service with one click (including log segmentation, log file analysis system, static resource compression, setting web cache time, hotlink protection, system version number hiding)
This experiment uses a collection of software packages (all open source software): link: https://pan.baidu.com/s/1Byuu3PWgCap85lqfqrA6eA extraction code: x806 please add a link description
Installation steps: manually compile and install apache → install dns service → for log segmentation → install log file analysis system → to compress static resources → facility web cache time → hotlink protection setting → version number hiding
#! / bin/bashyum install bind expect-y # install basic DNS and expect Interactive Free read-p "provide IP for hard disk:" ipsmbclient-L / / $ip/ > / var/named/zhy.zone#DNS configuration http= "/ usr/local/httpd/conf/httpd.conf" sed-I-e'/ Listen 80/s/ ^ / # /'- e "/ # Listen 12.34.56.78:80/s/#Listen 12.34.56.78:80/Listen $zhu: 80 / "$httpsed-I'/ # ServerName www.example.com/s/#ServerName www.example.com/ServerName www.zhy.com/' $httpcd / usr/local/httpd/bin/./apachectl startsed-I'/ ErrorLog\" logs\ / error_log\ "/ s/ErrorLog\" logs\ / error_log\ "/ ErrorLog\"\ |\ / usr\ / sbin\ / cronolog logs\ / www.zhy.com.error_\% Y\% d.log\ "/'$httpsed- I'/ CustomLog\ "logs\ / access_log\" common/s/CustomLog\ "logs\ / access_log\" common/CustomLog\ "\ |\ / usr\ / sbin\ / cronolog logs\ / www.zhy.com.access_\% Y\% m\% d.log\" combined/' $http#HTTP service changes monitoring, Change the domain name ln-s / usr/local/httpd/bin/* / etc/init.d/ service apachectl stopservice apachectl start# log partition cd / mnttar zxf awstats-7.6.tar.gzmv awstats-7.6 / usr/local/awstatscd / usr/local/awstats/tools/expect > / etc/crontabecho "* / 5 * root / usr/local/awstats/tools/awstats_updateall.pl now" > > / etc/crontab/bin/systemctl reload crond.servicesystemctl enable crond# creation plan Touch / usr/local/httpd/htdocs/houtai.htmlecho "> > / usr/local/httpd/htdocs/houtai.htmlecho" > > / usr/local/httpd/htdocs/houtai.htmlecho "> / usr/local/httpd/htdocs/houtai.htmlecho" > > / usr/local/httpd/htdocs/houtai.htmlservice apachectl stopservice apachectl startsystemctl stop firewalld.service Setenforce 0systemctl start named# log file segmentation system cd / mntsed-I'/ LoadModule deflate_ module modules\ / mod_ deflate.so/s/#/ /'$httpecho "" > > $httpecho "AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript" > $httpecho "DeflateCompressionLevel 9" > > $httpecho "SetOutputFilter DEFLATE" > > $httpecho "> > $http# static resource compression sed-I'/ LoadModule expires_module/s/#/ /'$httpecho" > > $httpecho " ExpiresActive On "> $httpecho" ExpiresDefault\ "access plus 30 seconds\" > $httpecho "> > $http# Page caching time sed-I'/ LoadModule rewrite_module/s/#/ /'$httpsed-I '248a RewriteEngine On\ nRewriteCond% {HTTP_REFERER}! ^ http://zhy.com/.*$ [NC]\ n RewriteCond% {HTTP_REFERER}! ^ http://zhy.com$ [NC]\ n RewriteCond% {HTTP_REFERER}! ^ http:// Www.zhy.com/.*$ [NC]\ nRewriteCond% {HTTP_REFERER}! ^ http://www.zhy.com/$ [NC]\ nRewriteRule. *\\. (gif | jpg | swf) $https://cache.yisu.com/upload/information/20200309/28/16809.jpg' $http# hotlink protection Please put the anti-theft image in the default site htdocs sed-I'/ httpd-default.conf/s/#/ /'$httpdefault= "/ usr/local/httpd/conf/extra/httpd-default.conf" sed-I '55s and FullUniverse' $default# hidden version number service apachectl stopservice apachectl startecho "Native IP is: $zhu"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.