[FreeBSD] Apache + MySQL + PHP + mod

Source: Internet
Author: User
[FreeBSD] ApacheMySQLPHPmod_fastcgiApache Security installing 1cdusrportswwwmod_fastcgi2makeinstallcleanMySQL installing 1cdusrportsdatabasesmysql51-server2make-DWIT

[FreeBSD] Apache MySQL PHP mod_fastcgi Apache Security 1 cd/usr/ports/www/apache22 2 make config install clean mod_fastcgi Security 1 cd/usr/ports/www/mod_fastcgi 2 make install clean MySQL Security 1 cd/usr/ports/databases/mysql51-server/2 make-DWIT

[FreeBSD] Apache + MySQL + PHP + mod_fastcgi


Apache Security

1 cd /usr/ports/www/apache22

2 make configinstall clean

Mod_fastcgi Security

1 cd /usr/ports/www/mod_fastcgi

2 make installclean

MySQL Security

1 cd /usr/ports/databases/mysql51-server/

2 make -DWITH_CHARSET=utf-8install clean

PHP security

1 cd /usr/ports/lang/php5

2 make configinstall clean # Except apache/debug, only the main PHP program is installed.

PHP Extensions security

1 cd /usr/ports/lang/php5-extensions/

2 make configinstall clean

3 # At least filter/mysql/gd/gettext/iconv/openssl must be selected in addition to the parameter settings.

Set

First, add it to/etc/rc. conf.

1 apache22_enable="YES"

2 mysql_enable="YES"

Then set the PHP settings.

1 cd /usr/local/etc

2 cp php.ini-recommended php.ini

3 # You can also use php. ini-development.

Activate MySQL

1 /usr/local/etc/rc.d/mysql-server start

Change Password

1 mysqladmin -u root -p password 'New secret secret'

Change Apache settings

1 vim /usr/local/etc/apache22/httpd.conf

1 ServerName FreeBSD.stu.edu.tw:80

2 # Undo the token, And Then paste it into your dns name or ip address.

3

4 LoadModule unique_id_module libexec/apache22/mod_unique_id.so

5 # If your host does not have a DNS, add the first line of the line to the resolution. During the operation, do not check the dns issue.

6

7 LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so

8 # Cancel the Token because fastcgi must be triggered.

9

10 DirectoryIndex index.html index.htm

11 # Add index. php

Then add fastcgi settings in the last inverted second line.

1 FastCgiConfig -maxClassProcesses 1 -idle-timeout 240

2

3 AddHandler fastcgi-script .fcgi

4 FastCgiIpcDir /var/log/apache2/

5 ScriptAlias /fcgi-bin/"/home/www/fcgi-bin/"

6

7 AllowOverride All

8 Order allow,deny

9 Allow from all

10 SetHandler fastcgi-script

11

12 AddHandler php-fastcgi .php

13 Action php-fastcgi /fcgi-bin/php

14

15 AddType application/x-httpd-php .php

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

Next, create a project named mkdir-p/home/www/fcgi-bin/
Add an example/home/www/fcgi-bin/php with the following content:

1 #!/bin/sh

2 PHPRC="/usr/local/etc"

3 export PHPRC

4 PHP_FCGI_CHILDREN=32

5 export PHP_FCGI_CHILDREN

6 exec /usr/local/bin/php-cgi

Save the statement, and then make the case readable.

1 chmod a+x /home/www/fcgi-bin/php

Check whether there is a problem with the parameter settings.

1 apachectl -t

Finally, initiate apache22

1 /usr/local/etc/rc.d/apache22 start

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.