lighttpd+php+mysql+openssl
FreeBSD 下Web环境的构建.
1 安装MySQL
这里是自己使用源码编译安装。
需要下载MySQL-4.0.25源码包。
cd /opt/distfiles
wget xxx
tar -zxvf mysql-4.0.25.tar.gz -C src
cd src/mysql-4.0.25/
./configure ?prefix=/opt/modules/mysql
?enable-assembler
?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 安装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 安装lighttpd
cd /usr/ports/www/lighttpd/
make install clean
执行后,将会提示一些选项只要选中OPENSSL 就可以了,其他的不用选。
4 整合配置
4.1 修改默认网站文件路径
server.document-root = “/opt/data/www/”
4.2 打开fastcgi模块支持
将 #”mod_fastcgi”, 的#去掉
4.3 设定PHP支持
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/opt/modules/phpcgi/bin/php”,
# 如果你的网站很繁忙,可以加入如下设置
#”bin-environment” => (
# “PHP_FCGI_CHILDREN” => “16″,
# “PHP_FCGI_MAX_REQUESTS” => “10000″
#)
#”bin-path” => “/usr/local/bin/php”
)))
4.4 创建日志文件及设置权限
touch /var/log/lighttpd.error.log
touch /var/log/lighttpd.access.log
chown www:www /var/log/lighttpd.*
4.5 设置SSL支持
4.5.1 创建证书
cd /opt/etc/
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
4.5.2 打开SSL支持
#### SSL engine
ssl.engine = “enable”
ssl.pemfile = “/opt/etc/server.pem”
4.6 设置监听端口
默认的监听端口是 80,如果需要更改端口,可以修改配置设定。
## bind to port (default: 80)
#server.port = 81
5 启动
5.1 设置自动启动
vi /etc/rc.conf
lighttpd_enable=”YES”
5.2 手工启动
/usr/local/etc/rc.d/lighttpd.sh start
注意,如果没有在/etc/rc.conf添加 /etc/rc.conf ,是不能启动的。所以需要先添加。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...
