Openbsd3.6 + APACHE + MYSQL + PHP + mod_limitipconn

Source: Internet
Author: User
Tags configuration php pkill
Author: llzqq: Openbsd3.6 + APACHE + MYSQL + PHP + mod_limitipconn: http://www.cnfug.org] <br/> Op author: llzqq [from: http://www.cnfug.org]




Openbsd 3.6 + APACHE + MYSQL + PHP + mod_limitipconn


Llzqq <llzqq@126.com>




You are welcome to post this article, but you must keep the following copyright information:




This article aims to build the server environment using the installation package provided by OPENBSD. of course, you can also download the original code package for compilation and installation, but the OPENBSD security is not guaranteed easily. As there is dependency between packages, the following lists all the installation packages used in this article. you can copy all the following packages to a directory and install them smoothly:




Freetype-1.3.1p1.tgz

Jpeg-6b.tgz

Php4-core-4.3.8.tgz

Php4-gd-4.3.8-no_x11.tg

Png-1.2.5p5.tgz

Recode-3.6p1.tgz

T1lib-5.0.0.tgz

Tiff-3.6.1p1.tgz

Mysql-client-4.0.20.tgz

Mysql-server-4.0.20.tgz

P5-DBD-mysql-2.9004.tgz

P5-DBI-1.43.tgz

P5-Net-Daemon-0.38.tgz

P5-PlRPC-0.2018.tgz

P5-PlRPC-0.2018.tgz.1

Mod_limitipconn-0.04.tar.gz




:

Http://ftp.it.net.au/OpenBSD/3.6/packages/i386/

Http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz




Configure APACHE server



Because APACHE is installed by default, the installation process is saved here.

Configure APACHE below to enable startup




# Vi/etc/rc. conf

Change:

Httpd_flags = NO

Is:

Httpd_flags = ""



Configure apache



# Vi/var/www/conf/httpd. conf




ServerAdmin llzqq@126.com

ServerName nero.3322.org

ServerTokens Prod

ServerSignature EMail







Install mysql-server-4.0.20



# Pkg_add mysql-server-4.0.20.tgz
# Cp/usr/local/share/mysql/my-medium.cnf/etc/my. cnf


If you do not want other machines to connect to MYSQL, perform the following operations:

# Vi/etc/my. cnf
Bind-address = 127.0.0.1


Start the MYSQL-SERVER server:

#/Usr/local/bin/mysqld_safe &

Set the root mysql password:

#/Usr/local/bin/mysqladmin-u root password your_password

The following script is created to enable and disable the MYSQL service:

# Vi/etc/rc. d/mysqld. sh
========================================================== ======================
#! /Usr/local/bin/bash
# Made by llzqq
#02/08/2004
# Mysql startup scripts


Case "$1" in



Start)

If [-x/usr/local/bin/mysqld_safe]; then

/Usr/local/bin/mysqld_safe &

Fi

;;




Stop)

Pkill mysqld &

Rm-f/var/run/mysql. sock &




;;

*)

Echo "$0 start | stop"

;;

Esac




Exit 0

========================================================== ======================




# Chmod 555/etc/rc. d/mysqld. sh





Set boot to start MYSQL


# Vi/etc/rc. local




If [-f/etc/my. cnf]; then

./Etc/rc. d/mysqld. sh start

Fi






Install configuration PHP-4.3.8




# Pkg_add php4-gd-4.3.8-no_x11.tgz



Run the following command to make it take effect



# Cp/usr/local/share/doc/php4/php. ini-recommended/var/www/conf/php. ini

#/Usr/local/sbin/phpxs-s

#/Usr/local/sbin/phpxs-a gd




Since APACHE on OPENBSD adopts the CHROOT mechanism, to ensure the normal operation of PHP, we need to create the following directory as the working directory of PHP:




# Mkdir/var/www/tmp
# Chmod 1777/var/www/tmp



# Pkg_add php4-mysql-4.3.8.tgz

Run the following command to make it take effect

#/Usr/local/sbin/phpxs-a mysql



# Pkg_add php4-ncurses-4.3.8.tgz

Run the following command to make it take effect

#/Usr/local/sbin/phpxs-a ncurses



# Pkg_add php4-imap-4.3.8.tgz

Run the following command to make it take effect

#/Usr/local/sbin/phpxs-a imap



# Vi/var/www/conf/httpd. conf


DirectoryIndex index.html index. php

AddType application/x-httpd-php. php

AddType application/x-httpd-php-source. phps




# Vi/var/www/conf/php. ini




Doc_root = "/htdocs"

Register_globals = On





Create a test php page


# Vi/var/www/htdocs/test. php






Test:


# Pkill httpd

#/Usr/sbin/httpd




Enter http: // IP/test. php in the browser to experiment.








Install the mod_limitipconn module to limit the number of concurrent connections of a single IP address




# Tar xzf mod_limitipconn-0.04.tar.gz
# Cd mod_limitipconn-0.04
# Vi Makefile

APXS =/usr/sbin/apxs


# Make

# Make install






# Vi/var/www/conf/httpd. conf








MaxConnPerIP 3









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.