zoukankan      html  css  js  c++  java
  • [学习笔记]FreeBSD 7.1下安装Lighttpd Web Server + MySQL Server + PHP

    1.最小化安装FreeBSD 7.1

    2.设置IP地址、网关、DNS等信息
    方法一(临时性):
    # ifconfig le0 192.168.0.173 /网卡le0可以通过ifconfig -a得到,不同机器名字不一定相同
    # route add default 192.168.0.254
    # ee /etc/resolv.conf
    添加1行
    nameserver 192.168.0.254 /也可使用OpenDNS提供的DNS地址:208.67.222.222、 208.67.220.220
    方法二(永久性):
    # ee /etc/rc.conf
    添加2行
    ifconfig_le0="inet 192.168.0.173 netmask 255.255.255.0"
    defaultrouter="192.168.0.254"
    # ee /etc/resolv.conf /此步骤同方法一一样

    3.升级系统补丁(根据需要重启,建议重启)
    # freebsd-update fetch
    # freebsd-update install
    如果出现了错误,可以使用下面的 freebsd-update 命令回退到上一次的修改。
    # freebsd-update rollback

    4.更新ports
    方法一:
    # portsnap fetch
    # portsnap extract /首次运行 Portsnap需进行此步骤
    # portsnap update
    方法二:
    设置更新服务器地址
    # setenv "ftp://cvsup2.cn.freebsd.org"
    添加cvsup更新程序
    # pkg_add -r cvsup-without-gui
    # cd /usr/share/examples/cvsup
    # ee ports-supfile
    修改其中的default host
    *default host=cvsup2.cn.freebsd.org
    # cvsup -g -L 2 ports-supfile

    5.安装lighttpd web server
    # cd /usr/ports/www/lighttpd
    # make config
    # make
    # make install
    # make clean

    FreeBSD Lighttpd 配置文件
    * 配置文件位置: /usr/local/etc/lighttpd.conf
    * 默认网站文档存放位置: /usr/local/www/data/
    * 默认的用户和组: www

    因为是www用户组所以修改lighttpd.conf中的日志存放路径
    # ee /usr/local/etc/lighttpd.conf
    修改server.errorlog和accesslog.filename
    server.errorlog = "/log/lighttpd.error.log"
    accesslog.filename = "/log/lighttpd.access.log"

    启动lighttpd
    # /usr/local/etc/rc.d/lighttpd start
    校验lighttpd是否运行
    # netstat -nat

    6.安装MySQL Server
    # cd /usr/ports/databases/mysql50-server
    # make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_PROC_SCOPE_PTH=yes BUILD_OPTIMIZED=yes BUILD_STATIC=yes SKIP_DNS_CHECK=yes WITHOUT_INNODB=yes
    # make install
    # make clean

    7.安装MySQL Client支持
    # cd /usr/ports/databases/mysql50-client
    # make
    # make install
    # make clean

    8.安装MySQL scripts
    # cd /usr/ports/databases/mysql50-scripts
    # make
    # make install
    # make clean

    启动MySQL Server
    # /usr/local/etc/rc.d/mysql-server start

    9.自动开始lighttpd和mysql服务
    # ee /etc/rc.conf
    添加2行
    mysql_enable="YES"
    lighttpd_enable="YES"

    10.安装php5 For lighttpd
    # cd /usr/ports/lang/php5
    # make config
    # make
    # make install
    # make clean

    11.安装php的extensions包
    # cd /usr/ports/lang/php5-extensions
    # make config
    # make
    # make install
    # make clean

    Next you must install PHP5 extensions such as GB, mysql support and so on.
    At least select following extensions from menu:

    * ctype: The ctype shared extension for php
    * curl: The curl shared extension for php
    * dom: The dom shared extension for php
    * gd: The gd shared extension for php
    * imap: The imap shared extension for php
    * mbstring: The mbstring shared extension for php
    * mcrypt: The mcrypt shared extension for php
    * mysql: The mysql shared extension for php
    * mysqli: The mysqli shared extension for php
    * pcre: The pcre shared extension for php
    * posix: The posix shared extension for php
    * session: The session shared extension for php
    * simplexml: The simplexml shared extension for php
    * xml: The xml shared extension for php
    * xmlreader: The xmlreader shared extension for php
    * xmlwriter: The xmlwriter shared extension for php
    * zlib: The zlib shared extension for php

    # ee /usr/local/etc/lighttpd.conf
    允许server.modules中的mod_fastcgi
    fastcgi.server = ( ".php" =>
    ( "localhost" =>
    (
    "socket" => "/var/run/lighttpd/php-fastcgi.socket",
    "bin-path" => "/usr/bin/php-cgi"
    )
    )
    )
    # mkdir /var/run/lighttpd
    # chown -R www:www /var/run/lighttpd/
    # /usr/local/etc/rc.d/lighttpd restart

    参考网站:
    http://www.cyberciti.biz/tips/howto-install-lighttpd-on-freebsd.html
  • 相关阅读:
    微信小程序通过CODE换取session_key和openid
    BZOJ1497[NOI2006]最大获利——最大权闭合子图
    Leetcode#149 Max Points on a Line
    IO流总结
    java基础比较好的笔记总结
    chrome web开发工具
    day 01 常量 注释 int(整型) 用户交互input 流程控制语句if
    10.2:异或树经验
    搜索+保存路径
    搜索+简单dp
  • 原文地址:https://www.cnblogs.com/chinalantian/p/2128143.html
Copyright © 2011-2022 走看看