Apache website Service source installation and site deployment

Source: Internet
Author: User
Tags fully qualified domain name

Brief introduction:

  In the Internet network environment, the Web service is undoubtedly the most mainstream application system, with a Web site, enterprises can fully display their products, companies, promote their corporate image, to provide a variety of online communication, business platform.

Apache origin: Originated from A patchy server (based on the original Web Service program code modified (patched) after the formation of the servers program), the latest name is "Apache HTTP server", the software name httpd

1995, Release 1.0 managed and maintained by Apache Group
1999, The Apache Software Foundation (Apache Software FOUNDATION,ASF) was established on the basis of Apache group and managed and maintained by ASF

Apache Software Foundation software:
Apache
Tomcat
Hadoop

Official site: http://httpd.apache.org/

Market share statistics for various web software: http://news.netcraft.com/

Installation method One: simple, fast, suitable for the experimental environment

[Email protected] ~]# yum-y install httpd

Installation Method II: Stable, full function, suitable for the production environment

Uninstall the RPM package before installing
[Email protected] ~]# rpm-q httpd
Httpd-2.2.15-39.el6.x86_64
[Email protected] ~]# rpm-e httpd--nodeps
[Email protected] ~]# rpm-q httpd
Package httpd are not installed

Unzip soft code software, configure, compile, install
[Email protected] ~]# tar XF httpd-2.2.31.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/httpd-2.2.31/
[Email protected] httpd-2.2.31]#/configure--prefix=/usr/local/httpd--enable-so--enable-rewrite-- Enable-charset-lite--enable-cgi && make && make install

--PREFIX=/USR/LOCAL/HTTPD Specifying the service program installation directory
--ENABLE-SO enabling dynamic load module functionality
--enable-rewrite Enable page rewriting
--enable-charset-lite Startup Character Set support
--ENABLE-CGI Enable CGI scripting support

[Email protected] httpd-2.2.31]# ls/usr/local/httpd/
Bin build Cgi-bin conf error htdocs icons include logs man manual modules

Bin Storage Execution Program
Cgi-bin Storing CGI programs
Conf storing the configuration file
Htdocs store Web files, such as HTML PHP, etc.
Lib holds the Execution Program Association library file
Logs storing log files
Man Store help manual file
Modules Storage Module

Optimize the execution path, use soft links (link the executing program to other directories), or modify the default search path:

[Email protected] httpd-2.2.31]# ln-s/usr/local/httpd/bin/*/usr/local/bin/
[Email protected] httpd-2.2.31]# ls-l/usr/local/bin/httpd/usr/local/bin/apachectl
lrwxrwxrwx 1 root root 30 August 22:52/usr/local/bin/apachectl-/usr/local/httpd/bin/apachectl
lrwxrwxrwx 1 root root 26 August 22:52/usr/local/bin/httpd-/USR/LOCAL/HTTPD/BIN/HTTPD

Querying HTTPD Service Program information
[Email protected] httpd-2.2.31]# httpd-v
Server version:apache/2.4.16 (Unix)
Server Built:aug 11 2015 22:42:13
[Email protected] httpd-2.2.31]# httpd-l
Compiled in Modules:
Core.c
Mod_so.c
Http_core.c
Worker.c

Adding HTTPD system Services
[Email protected] httpd-2.2.31]# CP/USR/LOCAL/HTTPD/BIN/APACHECTL/ETC/INIT.D/HTTPD
[Email protected] httpd-2.2.31]# VI/ETC/INIT.D/HTTPD
#!/bin/sh
#chkconfig: 35 80 20
#description: APACHE HTTPD SERVER
Define service startup order and shutdown order and description information

[Email protected] httpd-2.2.31]# chmod +x/etc/init.d/httpd
[Email protected] httpd-2.2.31]# chkconfig--add httpd
[Email protected] httpd-2.2.31]# chkconfig--list httpd
httpd 0: Off 1: Off 2: Off 3: Enable 4: Off 5: Enable 6: Off
[[Email protected] httpd-2.2.31]# service httpd start

Service startup Issue 1:

AH00557:httpd:apr_sockaddr_info_get () failed for Rhel6-server1
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1. Set the ' ServerName ' directive globally to suppress this message

[Email protected] ~]# vim +98/usr/local/httpd/conf/httpd.conf
Remove the # comment and change it to:
ServerName www.example.com:80

Re-launch Apache
[[Email protected] ~]# service httpd stop
[[Email protected] ~]# service httpd start
[Email protected] ~]# NETSTAT-ANPT |grep:80
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 86307/httpd

Service startup Issue 2:

/usr/local/apache/bin/httpd:error while loading shared libraries:libiconv.so.2:cannot open shared object File:no such File or directory
There are many so modules in the/usr/local/lib directory, so add/usr/local/lib in the/etc/ld.so.conf line

[Email protected] ~]# vi/etc/ld.so.conf
/usr/local/lib
[Email protected] ~]#/sbin/ldconfig-v
You have now installed Apach in/usr/local/apache. This installation supports Loadable modules
And the standard MPM prefork. You can then start the Apache server with the following command:
[[email protected] ~]#/usr/local/httpd/bin/apachectl start

Web site Deployment:

[Email protected] ~]# apachectl-t
Syntax OK
[Email protected] ~]# cat/usr/local/httpd/htdocs/index.html
[[Email protected] ~]# service httpd stop; Service httpd Start

Browser: http://192.168.200.211
[Email protected] ~]# tail-f/usr/local/httpd/logs/access_log
192.168.200.1--[11/aug/2015:23:06:12 +0800] "get/http/1.1" 200 45
192.168.200.1--[11/aug/2015:23:06:12 +0800] "Get/favicon.ico http/1.1" 404 209

Global configuration parameters: Acting on the entire Web service
ServerRoot: Service directory, when configuring a file in httpd.conf, if the relative path is used, it is considered to be in the service root directory
ServerAdmin: Admin Mailbox
User: Users running the Service identity daemon
Group: Run the service's identity daemon
ServerName: Domain name of the Web server
DocumentRoot: root directory of Web document
Listen: IP address, port number for listening TCP 80
Pidfile: Save the HTTPD process PID number file
DirectoryIndex: Default index page file
Errorlog: Location of error log files
Customlog: Location of access log files
LogLevel: Logging level, default is warn (warning)
Timeout: Network connection timed out, default is 300 seconds
KeepAlive: Whether to remain connected, optional on or off
Maxkeepaliverequests: Maximum number of requested files per connection
KeepAliveTimeout: Time-out when maintaining connection status
Include: Additional configuration files that need to be included
Charsetdefault: Setting the default character set encoding

Zone Configuration Items:
<directory/> Definition/Area start
Options followsymlinks allow use of symbolic links
AllowOverride None does not allow overlay configuration in implicit control files
Order Deny,allow define access control application sequence
Deny from all prohibits anyone from accessing
</Directory> definition/end of area

Website Access statistics: Deploy Awstats Analysis System


Http://mirrors.cnnic.cn/apache//httpd/httpd-2.2.31.tar.gz
Http://jaist.dl.sourceforge.net/project/awstats/AWStats/7.3/awstats-7.3.zip

AWSTATS an open-source log analysis system written in Perl, which allows you to analyze logs such as Apache Samba vsftpd IIS, and support simultaneous analysis of multiple Web sites to differentiate between sites by site name

[Email protected] ~]# Unzip Awstats-7.3.zip
[Email protected] ~]# MV Awstats-7.3/usr/local/awstats
[Email protected] ~]# cd/usr/local/awstats/tools/
[Email protected] tools]# chmod +x awstats_configure.pl
[Email protected] tools]#./awstats_configure.pl
Enter the site Master profile location:
/usr/local/httpd/conf/httpd.conf
Change the log type to combined
Y
Confirm the creation of the site configuration file
Y
Specify the target site name
Www.crushlinux.com
Accept the settings by default
Enter
Enter
Enter

Modify the Site configuration file
[Email protected] tools]# vim/etc/awstats/awstats.www.crushlinux.com.conf
Wuyi logfile= "/usr/local/httpd/logs/access_log"
[Email protected] ~]# mkdir/var/lib/awstats

Perform log analysis and set up scheduled tasks
[Email protected] ~]# cd/usr/local/awstats/tools/
[Email protected] tools]# chmod +x awstats_updateall.pl
[Email protected] tools]#./awstats_updateall.pl now
Running ' "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"-update-config=www.crushlinux.com-configdir= "/etc/ Awstats "to update config www.crushlinux.com
Create/update database for config '/etc/awstats/awstats.www.crushlinux.com.conf ' by Awstats version 7.3 (build 20140126)
From the data in log file "/usr/local/httpd/logs/access_log" ...
Phase 1:first bypass old records, searching new record ...
Searching new records from beginning of log file ...
Jumped lines in file:0
Parsed lines in File:4
Found 0 dropped Records,
Found 0 comments,
Found 0 Blank Records,
Found 4 Corrupted Records,
Found 0 old Records,
Found 0 New qualified records.

[Email protected] tools]# CRONTAB-E
*/1 * * * */usr/local/awstats/tools/awstats_updateall.pl now
[Email protected] tools]# service Crond restart
[Email protected] tools]# chkconfig--level Crond on

Browser: http://192.168.200.211/awstats/awstats.pl?config=www.crushlinux.com

[Email protected] tools]# vi/usr/local/httpd/htdocs/awb.html
<meta Http-equiv=refresh content= "0;
Http://192.168.200.211/awstats/awstats.pl?config=www.crushlinux.com ">
<body></body>
[[email protected] tools]#/etc/init.d/httpd stop
[[email protected] tools]#/etc/init.d/httpd start

Apache website Service source installation and site deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.