lighttpd+php+mysql+openssl

來源:互聯網
上載者:User
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 ,是不能啟動的。所以需要先添加。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.