1. How to Install httpd :
[root@centos64 ~]# yum install httpd -y
2. How to Check Apache server version :
[root@centos64 ~]# httpd -V Server version: Apache/2.2.15 (Unix) Server built: Feb 22 2013 11:19:58 Server's Module Magic Number: 20051115:25 Server loaded: APR 1.3.9, APR-Util 1.3.9 Compiled using: APR 1.3.9, APR-Util 1.3.9 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"
3. Change /etc/hosts file :
[root@centos64 ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.2.62 centos64.ehowstuff.local
4. Always backup the original configuration file before doing any changes :
[root@centos64 ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup.01042013Note : -p mean preserve the specified attributes (default: mode,ownership,timestamps)
5. How to Configure httpd Apache service :
[root@centos64 ~]# vi /etc/httpd/conf/httpd.conf
ServerTokens Prod KeepAlive On ServerAdmin root@ehowstuff.local ServerName www.ehowstuff.local:80 Options Indexes FollowSymLinks ExecCGI AllowOverride All DirectoryIndex index.html index.cgi index.php ServerSignature Off #AddDefaultCharset UTF-8 AddHandler cgi-script .cgi .pl
6. Restart Apache httpd :
[root@centos64 ~]# /sbin/service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
7. How to configure Apache httpd auto start at boot :
[root@centos64 ~]# chkconfig httpd on
8. How to check the apache access log :
[root@centos64 ~]# tail -f /var/log/httpd/access_log 192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2524 "http://192.168.2.62/" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0" 192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2146 "http://192.168.2.62/" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0" 192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET / HTTP/1.1" 200 71412 "-" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0" 192.168.2.52 - - [01/Apr/2013:23:14:36 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0" 192.168.2.52 - - [01/Apr/2013:23:14:36 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozi
0 comments:
Post a Comment