Considerations for configuring download servers in the Apache environment _linux

Source: Internet
Author: User

Environment

Platform: FreeBSD6.1

Server: APACHE2.0.59

Component:
LIBICONV-1.9.2_2.TBZ pkgconfig-0.20.tbz #pkg_add添加组件时需要的文件
LIBXML2-2.6.23_1.TBZ perl-5.8.8.tbz #要使用pkg_add添加的组件
mod_bw-0.7.gz mod_limitipconn-0.22.tar.gz #起到限速和限制IP多线程下载的模块

Depending on the version, there are times when you can install Apache directly, and if/BIN/APXS in the Apache home directory cannot load and compile modules, Perl support needs to be installed.

Perl was first installed on my machine.

Put these 6 components into the same directory, I used to put them in the/ROOT/SRC

#-----------------------------------------------------------------------------------------The first step--------------------------- ---------

Www#pkg_add LIBXML2-2.6.23_1.TBZ
Www#pkg_add PERL-5.8.8.TBZ
Www#tar ZXVF httpd-2.0.59.tar.gz
WWW#CD httpd-2.0.59
Www#./configure--prefix=/usr/local/apache--enable-so
Www#make
Www#make Install

#prefix用来制定安装APACHE的目录 enable-so is used to enable Apache to run and then load mod dynamic modules

We started loading two modules with restricted functionality

Www#/usr/local/apache/bin/apxs-i-c-a/root/src/mod_bw/mod_bw.c
Www#/usr/local/apache/bin/apxs-i-C-A/ROOT/SRC/MOD_LIMITIPCONN/MOD_LIMITIPCONN.C

If the load is successful, you can see if the/usr/local/apache/bin/httpd.conf has the following text

# LoadModule Foo_module modules/mod_foo.so
LoadModule Bw_module modules/mod_bw.so
LoadModule Limitipconn_module modules/mod_limitipconn.so

If it does, it means our Apache is loaded.

#-----------------------------------------------------------------------------------------Part II---------------------------- ------

Edit Apache Main configuration file

Find out if the following content in the/usr/local/apache/bin/httpd.conf file is configured correctly

DocumentRoot "/usr/local/apache/htdocs" specifies the root directory of your site

Find <directory/>
Options FollowSymLinks
AllowOverride None
</Directory>

Add in front

Bandwidthmodule on
Forcebandwidthmodule on
Bandwidth all 50000

The first two is to enable the speed limit mode, the third sentence is to set the limit speed of how much, the unit is byte. We set the speed limit below 50k

Find #extendedstatus on this line of configuration to cancel the previous comment "#", or write this sentence directly in the configuration above, and add the following:

<Location/down>
Maxconnperip 1
</Location>

Because in the/usr/local/apache/htdocs/down directory is the site to provide downloads of content, a single thread of the restrictions, if not specified/down this directory, it is likely to cause customers in the download content can not normally browse the Web page, Because browsing the web also produces a thread.

#-----------------------------------------------------------------------------------------------------------attached---------- -------------------------

Apache controls start or stop by Bin/apachectl or BIN/HTTPD.

#/usr/local/apache/bin/httpd-k Start #启动apache
#/usr/local/apache/bin/httpd-k Stop #停止apache
#/usr/local/apache/bin/httpd-k Restart #重启apache

If you want Apache to start with the machine, you can write a startup script and put it in the/ETC/RC.D directory.

Cd/usr/local/etc/rc.d
VI apache.sh
Add the following:
/usr/local/apache/bin/apachectl Start &
Execute: The wq! command exits after saving and executes the following command:
chmod 777 apache.sh

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.