Build the Web environment in lighttpd + php + mysql + openssl FreeBSD.
1. install MySQL
Here we will compile and install the SDK using the source code.
You need to download MySQL-4.0.25 source package.
Cd/opt/distfiles
Wget xxx
Tar-zxvf mysql-4.0.25.tar.gz-C src
Mysql-4.0.25/cd src/
./Configure? Prefix =/opt/modules/mysql
? Enable-cycler
? With-mysqld-ldflags =-all-static
? With-charset = gb2312
? Without-debug
Make
Make install
/Opt/modules/mysql/bin/mysql_install_db
Chown-R mysql. mysql/opt/modules/mysql/var
Chgrp mysql/opt/modules/mysql
2. install PHP
./Configure
? Prefix =/opt/modules/phpcgi
? Enable-fastcgi
? Enable-force-cgi-redirect
? Enable-bcmath
? Enable-inline-optimization
? Enable-magic-quotes
? Enable-wddx? Disable-debug
? Enable-sysvmsg
? Enable-sockets
? Enable-mbstring
? Enable-calendar
? With-trans-sid
? With-ldap
? With-ldap-sasl
? With-mysql =/opt/modulels/mysql
3. install lighttpd
Cd/usr/ports/www/lighttpd/
Make install clean
After the command is executed, some options are displayed as long as OPENSSL is selected. other options are not required.
4. integrated configuration
4.1 modify the default website file path
Server.doc ument-root = "/opt/data/www /"
4.2 enable fastcgi module support
Remove # of "mod_fastcgi"
4.3 set PHP support
#### Fastcgi module
# Read fastcgi.txt for more info
Fastcgi. server = (". php" =>
("Localhost" =>
(
"Socket" => "/tmp/php-fastcgi.socket ",
"Bin-path" => "/opt/modules/phpcgi/bin/php ",
# If your website is busy, add the following settings
# "Bin-environment" => (
# "PHP_FCGI_CHILDREN" => "16 ″,
# "PHP_FCGI_MAX_REQUESTS" => "10000 ″
#)
# "Bin-path" => "/usr/local/bin/php"
)))
4.4 create a log file and set permissions
Touch/var/log/lighttpd. error. log
Touch/var/log/lighttpd. access. log
Chown www: www/var/log/lighttpd .*
4.5 set SSL support
4.5.1 create a certificate
Cd/opt/etc/
Openssl req-new-x509-keyout server. pem-out server. pem-days 365-nodes
4.5.2 enable SSL support
#### SSL engine
Ssl. engine = "enable"
Ssl. pemfile = "/opt/etc/server. pem"
4.6 set listening port
The default listening port is 80. if you need to change the port, you can modify the configuration settings.
# Bind to port (default: 80)
# Server. port = 81
5. start
5.1 set automatic start
Vi/etc/rc. conf
Lighttpd_enable = "YES"
5.2 Manual start
/Usr/local/etc/rc. d/lighttpd. sh start
Note: If/etc/rc. conf is not added to/etc/rc. conf, it cannot be started. Therefore, you need to add it first.