megnlingling 发表于 2015-8-4 09:15:49

FREEBSD 8 +apache + php + mysql 配置


  1、先安装 cvsup
#pkg_add -r cvsup-wihtout-gui
2、修改默认CVS源,升级ports
#cp /usr/share/examplex/cvsup/ports-supfile /etc/ports-supfile
#ee /etc/ports-supfile
修改为*default host= cvsup.FreeBSDChina.org
#/usr/local/bin/cvsup -g -L 2 /etc/ports-supfile
3、编辑/etc/make.conf,增加PORT源
添加MASTER_SITE_OVERRIDE=ftp://ftp.cn.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}
4、安装MYSQL
  #cd /usr/ports/databases/mysql51-server/
#make install clean
  #/usr/local/bin/mysql_install_db --user=mysql
#/usr/local/etc/rc.d/mysql-server start
  5、安装apache
  #cd /usr/ports/www/apache22
#make install clean
  #make WITH_MPM=worker WITHOUT_IPV6=yes WITH_THREADS=yes WITHOUT_SSL=yes install clean
//如果是虚拟主机 应进入 apache22-peruser-mpm
//在虚拟主机配置文件中 ServerEnvironment user group 完成配置 重启apache 安全的apache2出现了
//当然 速度比prefork mpm慢 但是 安全第一!
//修改/usr/local/etc/apache22/httpd.conf
  //至于为什么WITH_MPM=worker 呵.我也学学某些人沉默方式..只可意会不可言传.自己google一下
//在我印象里.apache2如果不用worker运行方式的话相当于apache1.3的prefork.效率可能会更高.
//但带来的问题 似乎也不少..自己看着办.
//题外话:CU某些牛人说.安装WEB server 只需要四个包Apache php mysql perl就可以.
//如果是MINI安装.没有man+ports+src+sys+perl5.8的话.我想以我现在的水平看.那是不可能的.
  
  编辑httpd.conf
#ee /usr/local/etc/apache22/httpd.conf
ServerTokens Major
ServerSignature Off
Timeout 300
KeepAlive Off
UseCanonicalName Off
  
//查找 :
#Listen 12.34.56.78:80 //行,将该行下面的内容修改为
Listen 125.208.15.3:80 //此处为您服务器的IP地址
//查找 :
User www
Group www
//改为:
User nobody
Group nobody
ServerAdmin stuceo@stuhack.com
//再往下找..   
Options Indexes FollowSymLinks
//改为Options FollowSymLinks
//别说我没告诉你.163都会有这种错误.被黑客目录浏览到配置文件.到时候死了没我的事.

    DirectoryIndex index.html index.php

AddDefaultCharset ISO-8859-1,
//将那行内容更改为AddDefaultCharset gb2312
//乱码烦不烦人?
//再往下找 怎么着?烦了...烦了睡觉去吧.这儿你不看别想解析php!
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
//再下面添加
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
//最下面
Include etc/apache22/extra/httpd-mpm.conf //把#去掉
//ESC退出保存
#ee /usr/local/etc/apache22/extra/httpd-mpm.conf

    ServerLimit         3000
    StartServers          5
    MaxClients          5000
    MinSpareThreads      75
    MaxSpareThreads      300
    ThreadsPerChild      50
    MaxRequestsPerChild   80000

//切记... ServerLimit 3000 这儿一定要加上限制连接数..要不然重启的时候肯定报错
Starting Apache22
WARNING:MaxClients of 5000 would ruquire 100 servers,and would exceed the ServerLimit value of 16 Automatically lowering MaxClients to 800.To increase ,please see the ServerLimit directive.
//这是一网友告诉我的:MaxClients = StartServers * ThreadsPerChild
页: [1]
查看完整版本: FREEBSD 8 +apache + php + mysql 配置