Considerations for configuring the download server in the APACHE environment

  • 2020-05-10 23:22:42
  • OfStack

The environment

Platform: FreeBSD6.1  

Server: APACHE 2.0.59

Components:
  libiconv-1.9.2 _2.tbz       pkgconfig-0.20.tbz                 # espkg_add
  libxml 2-2.6.23 _1.tbz     perl-5.8.8.tbz                                   # USES the component added by pkg_add
  mod_bw-0.7. gz       mod_limitipconn-0.22.tar.gz           # to speed limit and limit IP multi-threaded download module

Depending on the version, sometimes you just need to install APACHE directly. If the /bin/apxs in the APACHE home directory cannot load and compile the module, you need to install perl support.

I installed perl on my machine first

Putting the above six components in the same directory, I'm used to /root/src

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- step 1 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -

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

    enable-so is used to load mod dynamic modules when APACHE is up and running

We start loading two modules with limited 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

Load success, whether can check under the 1 / usr local apache/bin/httpd conf whether has the following this paragraph

# LoadModule foo_module modules/mod_foo.so
  LoadModule bw_module                   modules/mod_bw.so
  LoadModule limitipconn_module modules/mod_limitipconn.so

If so, our APACHE is loaded

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2 department -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Edit the APACHE master configuration file

Find/usr local apache/bin/httpd conf files in the following content is configured properly

DocumentRoot "/ usr local/apache/htdocs"   whether specified is the root of their website

find < Directory / >
                    Options FollowSymLinks
                    AllowOverride None
              < /Directory >

Put in front

BandWidthModule On
  ForceBandWidthModule On
  BandWidth       all 50000

The first two sentences are to enable speed limit mode, and the third sentence is to set the limit speed, in bytes. We set the speed limit below 50k

Go to the #ExtendedStatus On configuration line and uncomment the "#" in front of you, or just write this in the above configuration and add:

  < Location /down >
  MaxConnPerIP 1
  < /Location >

Because in/usr local apache/htdocs/down devolution is the content of the website to download, to the limitation of single thread, if you don't specify/down this directory, is likely to cause customer unable to browse web pages, when download content for browsing the web also creates a thread.

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
Apache controls start or stop via bin/apachectl or bin/httpd.

# / usr local/apache/bin/httpd - k start   apache # started
# / usr local/apache/bin/httpd - k stop   stop apache #
# / usr local/apache/bin/httpd - k restart # restart apache

If you want APACHE to boot with machine 1, write a startup script in the /etc/ rc.d directory
 
cd /usr/local/etc/rc.d
  vi apache.sh
Add the following:
/usr/local/apache/bin/apachectl start &
Execution: wq! Exit after saving the command, and execute the following command:
chmod 777 apache.sh


Related articles: