[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 config install clean |
Mod_fastcgi Security
1 |
cd /usr/ports/www/mod_fastcgi |
MySQL Security
1 |
cd /usr/ports/databases/mysql51-server/ |
2 |
make -DWITH_CHARSET=utf-8 install clean |
PHP security
1 |
cd /usr/ports/lang/php5 |
2 |
make config install clean # Except apache/debug, only the main PHP program is installed. |
PHP Extensions security
1 |
cd /usr/ports/lang/php5-extensions/ |
2 |
make config install 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.
Then set the PHP settings.
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. |
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. |
7 |
LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so |
8 |
# Cancel the Token because fastcgi must be triggered. |
10 |
DirectoryIndex index.html index.htm |
Then add fastcgi settings in the last inverted second line.
1 |
FastCgiConfig -maxClassProcesses 1 -idle-timeout 240 |
3 |
AddHandler fastcgi-script .fcgi |
4 |
FastCgiIpcDir /var/log/apache2/ |
5 |
ScriptAlias /fcgi-bin/ "/home/www/fcgi-bin/" |
10 |
SetHandler fastcgi-script |
12 |
AddHandler php-fastcgi .php |
13 |
Action php-fastcgi /fcgi-bin/php |
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:
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.
Finally, initiate apache22
1 |
/usr/ local /etc/rc.d/apache22 start |