The prerequisite is that DNS is installed.
Installation: Yum-y Install httpd
Open 80 Ports:
Iptables-i input-p TCP--dport 80-j ACCEPT
Catalog:/etc/httpd/conf/httpd.conf #配置文件目录
/etc/httpd/conf.d/#引用配置目录
Vim/etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html" #网页文件目录
<directory "/var/www/html" > #目录设置
Options Indexes FollowSymLinks When there is Indexes, when there is no index.html file in the home directory, allow to view the directory list! To remove or delete or:-indexes
AllowOverride None #None不查找. htaccess file
Order Allow,deny #Order Control access, and last Deny is the default
Allow from all # usage deny ip1 IP2
</Directory>
Enable the AllowOverride method
mkdir/var/www/html/yy/
echo "yy" >/var/www/html/yy/index.html
Create a. htaccess file
Cd/var/www/html/yy
Vim. htaccess
AuthName Isyy
AuthType Basic
Authuserfile/var/www/html/.htaccess
Require
Save
Join User Ltiaw
htpasswd-cm. htaccess Ltiaw
Define Directory
<directory "/var/www/html/yy/" >
Options Indexes FollowSymLinks
AllowOverride authconfig
Order Deny,allow
Allow from 127.0.0.1
Deny from all
</Directory>
This enables user authentication
If you can't access it, be aware of SELinux or file permissions issues
Use a soft link to link the index.html in a different directory to the/var/www/html/directory
Mkdir/xx
echo "XX" >/xx/index.html
Ln-s/xx/index.html/var/www/html/
Custom Catalog
alias/aa/"/aa/"
Mkdir/aa
echo "AA" >/aa/index.html
Chcon-r--reference=/var/www/html//aa/
scriptalias/cgi-bin/"/var/www/cgi-bin" #定义可执行脚本的目录
cd/var/www/cgi-bin/
Create a script
Vim text.sh
#!/bin/bash/
Echo $date
Save
chmod 755./text.sh
Access Refresh
Virtual Host
Namevirtualhost
Set up 3 zones with DNS
respectively is
Baidu.com
google.com
Ltiaw.com
The first host name-based virtual host
Remove Annotations namevirtualhost*:80
Define host Name
<VirtualHost*:80>
Documentroot/baidu
ServerName www.baidu.com
</VirtualHost>
<VirtualHost*:80>
Documentroot/google
ServerName www.google.com
</VirtualHost>
<VirtualHost*:80>
documentroot/var/www/html/
ServerName www.ltiaw.com
</VirtualHost>
Chcon-r--reference=/var/www/html//baidu/google
/ETC/INIT.D/HTTPD restart
Successful access
The second IP address-based virtual host
IP Addr Show eth0
IP addr Add 192.168.30.251/24 dev eth0 label eth0:0
IP addr Add 192.168.30.252/24 dev eth0 label eth0:1
IP Addr Show eth0
Vim httpd.conf
Comment namevirtualhost*:80
Define IP
<virtualhost 192.168.30.251:80>
Documentroot/baidu
ServerName www.baidu.com
</VirtualHost>
<virtualhost 192.168.30.252:80>
Documentroot/google
ServerName www.google.com
</VirtualHost>
<virtualhost 192.168.30.250:80>
documentroot/var/www/html/
ServerName www.ltiaw.com
</VirtualHost>
/ETC/INIT.D/HTTPD restart
Successful access
HTTPS encryption
Yum-y Install Mod_ssl
Cd/etc/httpd/conf.d
Vim ssl.conf
Sslengin on #开启SSL
Define the Certificate directory
Sslcertificatefile/etc/httpd/conf/bb.crt
Sslcertificatekeyfile/etc/httpd/conf/bb.key
Save
Generate certificate
Cd/etc/pki/tls/certs
Make BB.CRT
After the build is complete, go to the Conf directory
CP bb.*/etc/httpd/conf
/ETC/INIT.D/HTTPD restart
Successful access
Encrypt only one station with SSL
Vim/etc/httpd/conf.d/ssl.conf
Sslengin off
Vim/etc/httpd/conf/httpd.conf
Under the virtual host you want to enable, add
<virtualhost 192.168.30.250:80>
documentroot/var/www/html/
ServerName www.ltiaw.com
Sslengin on
Sslcertificatefile/etc/httpd/conf/bb.crt
Sslcertificatekeyfile/etc/httpd/conf/bb.key
</VirtualHost>
/ETC/INIT.D/HTTPD restart
Log monitoring
Yum-y Install Webalizer
Vim/etc/httpd/conf.d/webalizer.conf
Change to All
Execute command to generate data
Webalizer
Restart
Visit http://192.168.1.250/usage
Another better-looking tool
awstats-7.4-1.noarch.rpm
:
Https://sourceforge.net/projects/awstats/files/AWStats/7.4/awstats-7.4-1.noarch.rpm/download
Yum-y Localinstall awstats-7.4-1.noarch.rpm
Configuration
Perform:
perl/usr/local/awstats/tools/awstats_configure.pl
Display after successful installation!
A Simple config file has been created:/etc/awstats/awstats.ltiaw.com.conf
You should has a look inside to check and the change manually main parameters.
You can then manually the update your statistics for ' ltiaw.com ' with command:
> Perl awstats.pl-update-config=ltiaw.com #更新数据命令
You can also read your statistics for ' ltiaw.com ' with URL:
> http://localhost/awstats/awstats.pl?config=ltiaw.com #访问网址
AB test
Ab-n 1000-c http://www.baidu.com/index.html/#-n 1000 visits,-C 10 parallel clients
Self-taught bird Brother service-HTTPD study record