twbsd.org
 
  Select Language: Home  SmbFTPD Forum 
FreeBSD
Forum -> FreeBSD
FreeBSD 9.1 x 64 Nginx + PHP-FPM + MySQL + eAccelerator + Memcached
Alex K -
作業項目:FreeBSD 9.1 x 64 Nginx+PHP-FPM+MySQL+eAccelerator+Memcached
日期時間:2013-06-07 PM 16:30 – 21:50 約5個多小時安裝過程, 感謝Habo張, Speq 邱, 深圳 陳與宮教授

作業環境:

DNS:www.77e68.com  ( Godaddy 申請指向 Pointhq, Pointhq再指向固IP)
  電腦:HP CQ43
  CPU:AMD 雙核k8-class
  RAM:2GB DDRII
  HD : 320GB
  DVD:

  網卡: rl0

  Hinet 光世代 50/10 M (固IP:114.35.236.160)

  帳號:74121xxx@ip.hinet.net

  密碼:werixxxx

用FreeBSD-9.1-RELEASE-amd64-memstick.img 及 FreeBSD-9.1-RELEASE-amd64-memstick.img 以隨身碟安裝OK! (系統最小安裝:ports + src大約 20分鐘完成)



如何設置 (Hinet 光世代 50/10 M)

在/etc/ppp/ppp.conf中,將原來的內容全部刪除,重新寫入內容:

==================================================

# file: /etc/ppp/ppp.conf

# added by Alex K 2013-06-07 19:00:00

default:

set log Phase tun command   #此行可略去,日誌用

set timeout 0

enable dns

pppoe:

set device PPPoE:xl0          # 對外網卡代號 xl0:3com網卡

set speed sync               # 此行可略去,速度設置用

set mru 1492

set mtu 1492

enable lqr

set dial

set login

set ifaddr 10.0.0.1/0 10.0.0.2/0

add default HISADDR

set authname 74121xxx@ip.hinet.net

set authkey werixxxx

==================================================

斷線:killall ppp

連線:ppp -ddial pppoe



# ee /etc/rc.conf 加入:

# pppoe support

ppp_enable=”YES”

ppp_mode=”ddial”

ppp_profile=”pppoe”



# sh /etc/rc     (重啟 rc.conf)



# ee /etc/resolv.conf 加入:

==================================================

# file: /etc/resolv.conf

# added by Alex K 2013-06-07 19:10:00

nameserver 127.0.0.1

nameserver 168.95.192.1

nameserver 168.95.1.1

==================================================

# portsnap fetch

# portsnap extract update     (下載安裝Ports完成大約 20分鐘完成)

# fsck –y

# cd /usr/ports/sysutils/screen

# make –DBATCH install clean; rehash

screen 安裝完成

# screen  [Enter]; [Enter]



安裝MySQL  (v5.6.11)

# cd /usr/ports/databases/mysql56-server

# make WITH_CHARSET=utf8 WITH_XCHARSET=all BUILD_OPTIMIZED=yes Install clean

  約 40 分鐘完成, 配置檔案:

# cp /usr/local/share/mysql/my-default.cnf /usr/local/etc/my.cnf

# rehash

# echo mysql_enable=”YES” >> /etc/rc.conf

# usr/local/etc/rc.d/mysql-server start  (啟動 mysql)

# ps –auxw | grep mysql            (查看是否正常啟動 mysql)



安裝 PHP   (v5.3.26)

# cd /usr/ports/lang/php53

# make config

  選取 CLI, CGI, FPM, SUHOSIN, ULTIBYTE, IPV6 等項目

# make install clean; rehash



安裝 PHP 擴展   (v5.3.26)

# cd /usr/ports/lang/php53-extensions

# make config

  選取 BCMATH, BZ2,….. 等項目

# make install clean; rehash

  最後支援 utf8要鈎, 約 100 分鐘完成, 配置檔案:/usr/local/etc/php-fpm.conf

# echo php_fpm_enable=”YES” >> /etc/rc.conf

# usr/local/etc/rc.d/php_fpm start   (啟動php_fpm)

# ps –auxw | grep php_fpm          (查看是否正常啟動 php_fpm)



安裝 NGINX   (v1.4.1,1)

# cd /usr/ports/www/nginx

# make install clean; rehash

  選取 IPV6, HTTP_....., WWW等項目

  nginx 安裝約 20 分鐘完成, 先不急著啟動 nginx

# ee /usr/local/etc/nginx/nginx.conf       (配置檔案)

找到下示內容, 先將段落前的#符號刪除, 並將 html 更改為 /usr/local/www/nginx

location ~ \.php$ {

  root /usr/local/www/nginx;

  fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

  include fastcgi_params;

}



# ee /usr/local/etc/nginx/fastcgi_params, 加入(注意 ; 號要打上)

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

# usr/local/etc/rc.d/nginx start      (啟動nginx)

# ps –auxw | grep nginx             (查看是否正常啟動 nginx)



# ee /usr/local/www/nginx/info.php, 加入

<? phpinfo() ?>

  儲存離開, 開啟 Google 瀏覽器, URL 鍵入 http://www.77e68.com/

  若看見 Nginx 歡迎畫面即表示 Web Server OK!



安裝 eAcceletrator

eAcceletrator 可以預編譯你的 PHP,這樣執行的時候,就會起到加速作用。(下圖紅色位址部分需要根據自己編譯結束後給出的位址修改)

# cd /usr/ports/www/eaccelerator

# make install clean

# echo zend_extension="/usr/local/lib/php/2013061307/eaccelerator.so" >> usr/local/etc/php.ini

# mkdir /tmp/eaccelerator

# chown www /tmp/eaccelerator

# chmod 0700 /tmp/eaccelerator

# /usr/local/etc/rc.d/php-fpm restart

鍵入 http://www.77e68.com/ info.php看是不是加入了 eAcceletrator 的支持



安裝memcached

# cd /usr/ports/databases/memcached

# make –DBATCH install clean; rehash

# cd /usr/ports/databases/pecl-memcache

# make –DBATCH install clean; rehash

# echo "memcached_enable=YES" >> /etc/rc.conf

# /usr/local/etc/rc.d/memcached start     (啟動memcached)
AlexK -
6/10 20:45:00
1. 安裝 wordpress, phpmyadmin, php53-ftp
2. Create a MySQL DataBase.
3. http://tw.wordpress.org/, 安裝 Wordpress
打開 Google 瀏覽器, 打入 http://www.77e68.com/, 一個 Sample 網頁出現在眼前,.....

Copyright © 2002-2024 Alex Wang from www.twbsd.org. All rights reserved.