Linux下快速搭建Apache/Lighttpd+PHP+MySQL_Linux教程
使用Ubuntu Linux, 編譯過程提示缺啥補啥即可.
Apache:
./configure --prefix=/home/work/httpd --enable-so --enable-rewrite
配置文件:
LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php # PhpIniDir /home/work/php/php.ini
MYSQL:
./configure --prefix=/home/work/mysql\ --with-unix-socket-path=/home/work/mysql/tmp/mysql.sock\ --with-big-tables\ --with-plugins=innobase groupadd mysql useradd -s /bin/false -g mysql -pmysql mysql /home/work/mysql/bin/mysql_install_db --user=mysql cp support-files/my-medium.cnf /home/work/mysql/etc/my.cnf
啟動:
/home/work/mysql/share/mysql/mysql.server start
修改密碼 mysqladmin password ‘xxx’
出錯: Starting MySQL.Manager of pid-file quit without updating fi[FAILED]
解決: 權(quán)限問題, 他媽的MySQL都提示些什么狗屎!
innodb
如果還不支持innodb, 進入mysql命令行執(zhí)行:
install plugin innodb soname ‘ha_innodb.so’;
PHP:
PHP 一定要安裝 APC 模塊, 否則性能會下降不少: http://pecl.php.net/package/APC (編譯PHP模塊的方法)
用Apache
./configure --prefix=/home/work/php --with-config-file-path=/home/work/php\ --with-mysql=/home/work/mysql\ --enable-mbstring\ --with-pdo-mysql=/home/work/mysql\ --with-apxs2=/home/work/httpd/bin/apxs\ --with-gettext\ --enable-soap\ --with-zlib\ --with-gd\ --with-jpeg=/usr/lib
將源碼目錄下的php.ini-dist文件改名為php.ini, 拷貝到/home/work/php目錄下.
用Lighttpd
./configure --prefix=/home/work/litty/php --with-config-file-path=/home/work/litty/php\ --with-mysql=/home/work/mysql\ --enable-mbstring\ --with-pdo-mysql=/home/work/mysql\ --with-gettext\ --enable-soap\ --with-zlib\ --enable-fastcgi\ --enable-force-cgi-redirect\ --with-gd\ --with-jpeg=/usr/lib
需要安裝libjpeg62_dev
不能同時使用apxs2和fastcgi.
配置Apache虛擬主機
<VirtualHost *:80> DocumentRoot "/home/work/htdocs/ideawu.net" ServerName ideawu.net ServerAlias ideawu.net *.ideawu.net ErrorLog "/home/work/logs/ideawu.net-error.log" CustomLog "/home/work/logs/ideawu.net-access.log" common DirectoryIndex index.php index.html index.htm <Directory "/home/work/htdocs/ideawu.net"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
安裝配置Lighttpd(litty)
$HTTP["host"] =~ "(.*\.)?ideawu.net" { server.name = "www.ideawu.net" server.document-root = "/home/work/htdocs/ideawu.net/" server.errorlog = "/home/work/litty/logs/ideawu.net-error.log" accesslog.filename = "/home/work/litty/logs/ideawu.net-access.log" } fastcgi.server = ( ".php" => ( ( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/home/work/litty/php/bin/php-cgi", #"min-procs" => 2, #這個參數(shù)在新版本里已經(jīng)不起作用了. "max-prccs" => 16, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "1", "PHP_FCGI_MAX_REQUESTS" => "10000" ), ) ) )
(版本1.4.26), 已經(jīng)集成了spawn-fcgi, 也就是不再單獨生成這個名字的可執(zhí)行文件, min-procs參數(shù)也不再起作用. 啟動的php-cgi進程數(shù)是
max-procs * ( PHP_FCGI_CHILDREN + 1 ), PHP_FCGI_CHILDREN默認=1.
相關(guān)Linux教程:
- Linux系統(tǒng)下TOP命令使用與分析詳解
- 安裝Linux我們需要改變20件事情
- 使用Linux系統(tǒng)架設VSFTP服務器
- Linux系統(tǒng)上架設POP3服務器
- Linux中“Networking Disabled”的解決方法(解決Ubuntu等系統(tǒng)無法上網(wǎng))
- ubuntu系統(tǒng)清理磁盤教程
- linux下搭建pxe自動化安裝環(huán)境
- BIOS不支持導致Linux內(nèi)核耗電增加
- Debian GNU/Linux系統(tǒng)卡片
- Linux操作系統(tǒng)開機自行啟動項目詳細解析
- Linux菜鳥入門級命令大全
- Linux操作系統(tǒng)中讀取目錄文件信息的過程
- 相關(guān)鏈接:
- 教程說明:
Linux教程-Linux下快速搭建Apache/Lighttpd+PHP+MySQL。