1install sendemailtarxvfsendemail-v1.56.tar.gz mvsendEmail-v1.56sendEmail2 add apache Virtual Host shell script: viaddVirtual. sh #! /Bin/bashcat & lt; EOF & gt;/etc/httpd/conf/httpd. conf & lt; VirtualHost *: 80 & gt ;&
1. Install sendEmail
Tar xvf sendEmail-v1.56.tar.gz
Music sendEmail-v1.56 sendEmail
2. Add the apache VM shell script:
Vi addVirtual. sh
#! /Bin/bash
Cat < >/Etc/httpd/conf/httpd. conf
ServerAdmin admin @ $1
DocumentRoot/$1
ServerName $1
ErrorLog logs/$ 1-error_log
CustomLog logs/$ 1-access_log common
EOF
Mkdir/$1
Chmod 755/$1
Service httpd restart
Port = 'netstat-anl | grep 80 | sed-n '1p' | awk' {print $4} '| awk-F:' {print $2 }''
Ip = 'ifconfig eth0 | sed-n 2p | awk '{print $2}' | awk-F: '{print $2 }''
If ["$ port "! = "80"]
Then
/Home/shell/sendEmail-f xxx @ xxx-t xxx @ xxx-s smtp. xxx-u "An error occurred while starting apache !!! "-Xu USER-xp PASSWD-m" $ {ip} apache shutdown, Please contact the administrator"
Fi
Run the script to add a VM:
NameVirtualHost *: 80 #### account opening required ###
[Root @ 3 shell] # sh addVirtual. sh 2.test.com ### 2.test.com is the domain name entered by the user ####
Test:
Add the following in the local hosts file:
192.168.2.5 2.test.com
192.168.2.5 3.test.com
Access 2.test.com #### create a homepage under the generated/2.test.com file ####
######### Using a simple script to configure multiple virtual hosts is fast. The above script can be used with PHP to configure virtual hosts on the PHP page for convenience ....
Address: http://youzao.blog.51cto.com/3946111/741077