標籤:localhost 設定檔 master file
一.####mail 空殼郵件####
設定檔 (maillinux.linux.com)
---------------------------------
19 zone "localhost" IN {
20 type master;
21 file "named.localhost";
22 allow-update { none; };
23 };
24
25 zone "westos.org" IN {
26 type master;
27 file "westos.org.zone";
28 allow-update { none; };
29 };
---------------------------------
cp -p named.localhost westos.org.zone
vim /etc/named/westos.org.zone
--------------------------------------------------------
1 $TTL 1D
2 @ IN SOA dns.westos.com. root.westos.org. (
3 0 ; serial
4 1D ; refresh
5 1H ; retry
6 1W ; expire
7 3H ) ; minimum
8 NS dns.westos.org.
9 dns A 172.25.254.100
10 westos.org. MX 1 172.25.254.100.
--------------------------------------------------------
rm -fr /etc/postfix/main.cf
yum reinstall postfix.x86_64 -y
vim /etc/postfix/main.cf
----------------------------------------------
75 myhostname = maillinux.linux.com
83 mydomain = linux.com
98 myorigin = westos.org
113 inet_interfaces = all
116 #inet_interfaces = localhost
164 mydestination =
313 relayhost = 172.25.254.100 ##間接發送 ip為接受地址
140 local_transport = error:local delivery disabled
----------------------------------------------
systemctl restart postfix.service
systemctl start named
在(mailwestos.westos.com)
vim /etc/postfix/main.cf
264 mynetworks = 172.25.254.0/24
systemctl restart postfix.service
www.extmail.org 郵件系統
lamp=linux apache mysql php lnmp=linux nginx mysql php
二. curl 查看網站資訊
curl -I www.baidu.com
yum install nmap 著名駭客軟體(侵入系統)
server: tengine
三.#### apache ####
1.httpd
yum install httpd -y
cd /var/www/html/
vim index.html
page 123
rpm -qc httpd
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf.modules.d/00-dav.conf
/etc/httpd/conf.modules.d/00-lua.conf
/etc/httpd/conf.modules.d/00-mpm.conf
/etc/httpd/conf.modules.d/00-proxy.conf
/etc/httpd/conf.modules.d/00-systemd.conf
/etc/httpd/conf.modules.d/01-cgi.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/logrotate.d/httpd
/etc/sysconfig/htcacheclean
/etc/sysconfig/httpd
vim /etc/httpd/conf/httpd.conf
----------------------------------
163 <IfModule dir_module>
164 DirectoryIndex index.html
165 </IfModule>
----------------------------------
##不用修改
用firefox測試 172.25.254.100/index.html
###修改firefox的預設目錄###
[[email protected] html]# yum install httpd-manual -y
[[email protected] html]# ls -Zd . ##表示列出檔案的安全資訊內容
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 .
[[email protected] html]# mkdir /www/westos -p
[[email protected] html]# semanage fcontext -a -t httpd_sys_content_t ‘/www/westos(/.*)?‘
[[email protected] html]# restorecon -RvvF /www/
restorecon reset /www context unconfined_u:object_r:default_t:s0->system_u:object_r:default_t:s0
restorecon reset /www/westos context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
[[email protected] html]# cd /www/westos/
[[email protected] westos]# ls
[[email protected] westos]# vim index.html
------------------
網站內容……
------------------
[[email protected] westos]# ls -Z
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 index.html
[[email protected] westos]# semanage fcontext -a -t httpd_sys_content_t ‘/www/westos(/.*)?‘
vim /etc/httpd/conf/httpd.conf
--------------------------------
119 #DocumentRoot "/var/www/html"
120 DocumentRoot "/www/westos"
121 <Directory "/www/westos">
122 require all granted
123 </Directory>
42 Listen 80 ##監聽連接埠 預設為80
-------------------------------
systemctl restart httpd
systemctl reload httpd
####網站登陸ip限制####
vim /etc/httpd/conf/httpd.conf
------------------------------
119 #DocumentRoot "/var/www/html"
120 DocumentRoot "/www/westos"
121 <Directory "/www/westos">
122 require all granted
123 Order Allow,Deny ##注意讀取的順序
124 Deny from ALL
125 Allow from 172.25.254.250 172.25.254.1
---------------------------------------------
####使用者認證登入####
cd /etc/httpd/
ls
conf conf.d conf.modules.d logs modules run
htpasswd -cm htpasswdfile westos ##建立登入web的使用者 首次加上"-c"
htpasswd -m htpasswdfile admin ##建立其他登入使用者 不用加"-c",否則覆蓋第一次建立的使用者
ls
conf conf.d conf.modules.d htpasswdfile logs modules run
cat /etc/httpd/htpasswdfile
westos:$apr1$N2tH2dYs$KF7NFjH/OPn.lt.axBc4d.
admin:$apr1$VKKy4N9E$wDUCX1F.fpOfOMVQ6VOPh.
vim /etc/httpd/conf/httpd.conf
-----------------------------------------------------------
120 DocumentRoot "/www/westos"
121 <Directory "/www/westos">
122 #require all granted
123 AllowOverride All
124 Authuserfile /etc/httpd/htpasswdfile
125 Authname "Please input username and password"
126 Authtype basic
127 Require valid-user
128 </Directory>
-----------------------------------------------------------
vim /etc/hosts
6 172.25.254.100 mailwestos.westos.com ##網域名稱解析
mkdir /var/www/virtual/news.westos.com/html -p
mkdir /var/www/virtual/music.westos.com/html -p
在測試主機上 修改/etc/hosts
172.25.254.100 www.westos.com westos.com news.westos.com music.westos.com
vim /etc/httpd/conf.d/default
1 <Virtualhost _default_:80>
2 Documentroot //var/www/html
3 Customlog "logs/default.log" combined
4 </Virtualhost>
5 <Directory "/var/www/html">
6 Require all granted
7 </Directory>
vim /etc/httpd/conf.d/music.conf
1 <Virtualhost *:80>
2 Servername music.westos.com
3 Documentroot /var/www/virtual/music.westos.com/html
4 Customlog "logs/music.log" combined
5 </Virtualhost>
6 <Directory "/var/www/virtual/music.westos.com/html">
7 Require all granted
8 </Directory>
vim /etc/httpd/conf.d/news.conf
同上
2.配置https
yum install mod_ssl -y
yum search util
yum install crypto-utils
genkey www.westos.com
進入選項模式
650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/8B/4C/wKioL1hJQ-ywsLUxAAMlAVKc9lA092.png-wh_500x0-wm_3-wmp_4-s_3826059503.png" title="2016-12-08 18:01:43 的截屏.png" alt="wKioL1hJQ-ywsLUxAAMlAVKc9lA092.png-wh_50" />
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/8B/50/wKiom1hJQ_nhK7h_AAM0FNY2KsY322.png-wh_500x0-wm_3-wmp_4-s_394881705.png" title="2016-12-08 17:38:11 的截屏.png" alt="wKiom1hJQ_nhK7h_AAM0FNY2KsY322.png-wh_50" />
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/8B/50/wKiom1hJRAnydZOIAAOPuqfY1Pw232.png-wh_500x0-wm_3-wmp_4-s_3747888629.png" title="2016-12-08 17:38:04 的截屏.png" alt="wKiom1hJRAnydZOIAAOPuqfY1Pw232.png-wh_50" />650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/8B/50/wKiom1hJRFOTmwT6AAF9tdKkGZQ128.png-wh_500x0-wm_3-wmp_4-s_958929110.png" title="2016-12-08 17:37:58 的截屏.png" alt="wKiom1hJRFOTmwT6AAF9tdKkGZQ128.png-wh_50" />
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/8B/50/wKiom1hJRGzxNzvgAAL9iIzOxWc255.png-wh_500x0-wm_3-wmp_4-s_2238130803.png" title="2016-12-08 17:37:51 的截屏.png" alt="wKiom1hJRGzxNzvgAAL9iIzOxWc255.png-wh_50" />
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8B/50/wKiom1hJRJnAlRCOAALJeD7l7cc917.png-wh_500x0-wm_3-wmp_4-s_3572793806.png" title="2016-12-08 17:38:36 的截屏.png" alt="wKiom1hJRJnAlRCOAALJeD7l7cc917.png-wh_50" />
最終出現:
-------------------------------------------------------------------------------
/usr/bin/keyutil -c makecert -g 1024 -s "CN=www.westos.com, OU=linux, O=westos, L=xi‘an, ST=shannxi, C=CN" -v 1 -a -z /etc/pki/tls/.rand.4813 -o /etc/pki/tls/certs/www.westos.com.crt -k /etc/pki/tls/private/www.westos.com.key
cmdstr: makecert
cmd_CreateNewCert
command: makecert
keysize = 1024 bits
subject = CN=www.westos.com, OU=linux, O=westos, L=xi‘an, ST=shannxi, C=CN
valid for 1 months
random seed from /etc/pki/tls/.rand.4813
output will be written to /etc/pki/tls/certs/www.westos.com.crt ##認證
output key written to /etc/pki/tls/private/www.westos.com.key ##公開金鑰
Generating key. This may take a few moments...
Made a key
Opened tmprequest for writing
/usr/bin/keyutil Copying the cert pointer
Created a certificate
Wrote 882 bytes of encoded data to /etc/pki/tls/private/www.westos.com.key
Wrote the key to:
/etc/pki/tls/private/www.westos.com.key
------------------------------------------------------------------------------
vim /etc/httpd/conf.d/ssl.conf
------------------------------------------------------------------------------
100 SSLCertificateFile /etc/pki/tls/certs/www.westos.com.crt ##認證
101
102 # Server Private Key:
103 # If the key is not combined with the certificate, use this
104 # directive to point at the key file. Keep in mind that if
105 # you‘ve both a RSA and a DSA private key you can configure
106 # both in parallel (to also allow the use of DSA ciphers, etc.)
107 SSLCertificateKeyFile /etc/pki/tls/private/www.westos.com.key ##公開金鑰
------------------------------------------------------------------
本文出自 “12100661” 部落格,謝絕轉載!
三.mail空殼 apache