OPENBSD 3.6 + APACHE + MYSQL + PHP + MoD

Source: Internet
Author: User
Tags chmod imap ini mysql net pkill
apache | mysql Author: llzqq [article from: http://www.cnfug.org]
Openbsd 3.6 + APACHE + MYSQL + PHP + mod_limitipconn
llzqq <llzqq@126.com>

Everyone is welcome to repost this article, but keep the following copyright information:

This article aims to use the installation package provided by OPENBSD to build a server environment. Of course, you can also download the original code package to compile and install, but the security of OPENBSD is not easy to guarantee. Because there are dependencies between the packages, all the installation packages used in this article are listed below. You can copy all the packages below to a directory and install it 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

download link:

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 omitted here.

The following configuration APACHE so that it can be started
# vi /etc/rc.conf
change:
httpd_flags = NO
for:
httpd_flags = ""



Make a preliminary setting for Apache
ar / 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 don't want other machines to connect to MYSQL, you can use 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 MySQL password for ROOT:
# / usr / local / bin / mysqladmin -u root password your_password

To facilitate starting and stopping the MYSQL service, the following script is created:
# 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/mysql.sock &
;;
*)
echo "$ 0 start | stop"
;;
esac
exit 0

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

# chmod 555 /etc/rc.d/mysqld.sh
Set up startup MYSQL
# vi /etc/rc.local

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

. /etc/rc.d/mysqld.sh start

fi

Install and configure 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 uses the CHROOT mechanism, to ensure that PHP works properly, the following directory must be created as the working directory for 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


Build test php page


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

<? php phpinfo ();?>


have a test:

# pkill httpd

# / usr / sbin / httpd

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

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


# 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

<IfModule mod_limitipconn.c>

<Location />

MaxConnPerIP 3

</ Location>

</ IfModule>

Related Article

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.