Episode IV

31, your favorite Nginx module, used to do
rewrite module, rewriting
access module: source control
ssl module: security encryption
ngx_http_gzip_module: network transmission compression module
ngx_http_proxy_module module implements a proxy
ngx_http_upstream_module back-end server module implementation-defined list
ngx_cache_purge implement caching clearance

32, please list your understanding of web server load architecture
Nginx
Haproxy
Keepalived
LVS

33, see http requests concurrent TCP connections thereto

netstat -n | awk '/ ^ tcp / {++ S [$ NF]} END {for (a in S) print a, S [a]}'
also see linux system ulimit -n maximum open file descriptor here the default 1024
does not modify the web server modifications here and then a big useless, to modify the very few ways to use it, here to say one:
modify /etc/security/limits.conf

nofile 10240 Soft
Hard 10240 nofile
take effect after the restart
34 to see who the highest use access port 80 tcpdump sniffer
tcpdump -i eth0 -tnn dst port 80 -c 1000 | "." awk -F '{print $ 1 $ 2 "." . "" $ 3 $ 4} '. "" | the Sort | uniq -c | the Sort -nr | head -20
35, to write a script to achieve judge 192.168.1.0/24 network, which currently online IP, can ping the that line
for IP 255 in SEQ. 1
do
{
of ping. 1 192.168.1 -C $ IP> / dev / null 2> &. 1.
IF [-eq $ 0?]; the then
. 192.168.1 $ IP echo the UP
the else
echo 192.168. $ ip dOWN 1.
fi
} &
DONE
the wait
36, known apache service access log records by day in the server's local directory / app / logs, because the disk space is tight now requires only keep the last 7 days access log! How can we solve? Give settlements or configuration or processing commands
to create a script file:
for the n-seq in 14
do
DATE -s "11 / $ the n-0/14"
Touch access_www_ (DATE +% F) .log
done
解决方法:
-rw-r–r–. 1 root root 0 Jan 1 00:00 access_www_2015-01-01.log
-rw-r–r–. 1 root root 0 Jan 2 00:00 access_www_2015-01-02.log
-rw-r–r–. 1 root root 0 Jan 3 00:00 access_www_2015-01-03.log
-rw-r–r–. 1 root root 0 Jan 4 00:00 access_www_2015-01-04.log
-rw-r–r–. 1 root root 0 Jan 5 00:00 access_www_2015-01-05.log
-rw-r–r–. 1 root root 0 Jan 6 00:00 access_www_2015-01-06.log
-rw-r–r–. 1 root root 0 Jan 7 00:00 access_www_2015-01-07.log
-rw-r–r–. 1 root root 0 Jan 8 00:00 access_www_2015-01-08.log
-rw-r–r–. 1 root root 0 Jan 9 00:00 access_www_2015-01-09.log
-rw-r–r–. 1 root root 0 Jan 10 00:00 access_www_2015-01-10.log
-rw-r–r–. 1 root root 0 Jan 11 00:00 access_www_2015-01-11.log
-rw-r–r–. 1 root root 0 Jan 12 00:00 access_www_2015-01-12.log
-rw-r–r–. 1 root root 0 Jan 13 00:00 access_www_2015-01-13.log
-rw-r–r–. 1 root root 0 Jan 14 00:00 access_www_2015-01-14.log

May also be used -exec rm -f {}; delete
-rw-R- R & lt-0. 1 the root the root. 7 Jan 00:00 access_www_2015-01-07.log.
-Rw-R- R & lt-0. 1 the root Jan the root. 00:00 access_www_2015-01-08.log. 8
-rw-R & lt-R-. 0. 1 the root the root. 9 Jan 00:00 access_www_2015-01-09.log
-rw-R & lt-R-. the root the root. 1 0 00 Jan 10 : 00 access_www_2015-01-10.log
. -rw the root. 1-R & lt R--Jan. 11 0 00:00 access_www_2015-01-11.log the root
. R & lt -rw-0-R- Jan the root 12 is the root. 1 00:00 access_www_2015-01-12.log
-rw-R & lt-R-.. 1 the root 13 is the root 0 Jan 00:00 access_www_2015-01-13.log
-rw-R & lt-R-. the root the root. 1 0 14 Jan 00:00 access_www_2015- 01-14.log
37, how to optimize the Linux system (can not say too specific)?
No root, add a normal user, the sudo authorized management
to change the default remote connection SSH service port and prohibit root users to connect remotely
regular automatic update server time
configuration domestic yum source
close selinux and iptables (iptables scenes work if there is external network IP must be open , except for high concurrency)
Adjust the number of file descriptors
to streamline start-up service (crond rsyslog network sshd)
kernel parameter optimization (/etc/sysctl.conf)
change the character set to support the Chinese, but the proposal is still in English character set, preventing garbled
locking critical system files
Clear / etc / issue, remove the front of the screen display system and kernel version Login

38, execute the command in the extracted IP address of eth0 linux (Please cut, may have the ability to use awk respectively, sed Command A)
Cut Method. 1:
the ifconfig eth0 | -n Sed '2P' | Cut -d ":" -f2 | Cut -d "" -f1
192.168.20.130

awk方法2:
ifconfig eth0 | awk 'NR == 2' | awk -F ":" '{print $ 2}' | awk '{print $ 1}'
192.168.20.130

Method awk multiple delimiters. 3:
the ifconfig eth0 | awk 'NR == 2' | awk -F "[:] +" '. 4} {Print $'
192.168.20.130

Method sed. 4:
the ifconfig eth0 | sed -n '/ inet addr / P' | -R & lt sed '... S ^ # :( DDR) ## Bc * $ G'
192.168.20.130
39, please write the following linux SecureCRT command-line shortcut command function?

Ctrl + a
Ctrl + c
Ctrl + d
Ctrl + e
Ctrl + l
Ctrl + u
Ctrl + k
tab
Ctrl+shift+c
Ctrl+shift+v

Answer:
the Ctrl + A -> move the cursor to the beginning
Ctrl + e -> move the cursor to the end of the line
Ctrl + c -> terminate the current program
Ctrl + d -> if the character before the cursor is deleted, there is no exit current interrupt
Ctrl + l -> clear screen
Ctrl + u -> cut previous character cursor
Ctrl + k -> after the character cursor shear
Ctrl + y -> copy u / k contents
Ctrl + r - -> Find recently used command
tab -> command or the path to completion
Ctrl + shift + c -> copy
Ctrl + shift + v -> paste
40, 12 o'clock every night, packing site directory / var / www / html to the backup / data directory (preferably each backup packet generated by different backup time)

$ cat a.sh
#!/bin/bash
cd /var/www/ && /bin/tar zcf /data/html-date +%m-%d%H.tar.gz html/

$ crontab –e
00 00 * * * /bin/sh /root/a.sh

Guess you like

Origin www.cnblogs.com/Juvenile/p/12602862.html