FreeBSD安裝配置Nginx+PHP+APC+MySQL
在 FreeBSD 下安裝軟體的傳統方法是用 ports 原始碼安裝,不過使用 ports 原始碼編譯安裝太耗時(尤其是各種庫依賴多、大的時候),個人還是喜歡 pkg 這種軟體包管理工具直接安裝編譯好的二進位制軟體包,不用自己編譯,省時省力。
FreeBSD 也能一行命令解決所有安裝和軟體包依賴問題
# pkg install nginx php55 php55-extensions pecl-APC mysql56-server
Updating repository catalogue
The following 23 packages will be installed:
Installing nginx: 1.4.7,1
Installing php5-session: 5.4.26
Installing php5-xmlwriter: 5.4.26
Installing php5-dom: 5.4.26
Installing php5-xml: 5.4.26
Installing php5-simplexml: 5.4.26
Installing php5-ctype: 5.4.26
Installing php5-posix: 5.4.26
Installing php5-hash: 5.4.26
Installing php5-filter: 5.4.26
Installing php5-tokenizer: 5.4.26
Installing php5-json: 5.4.26
Installing php5-sqlite3: 5.4.26
Installing php5-pdo: 5.4.26
Installing php5-iconv: 5.4.26
Installing php5-phar: 5.4.26
Installing pecl-APC: 3.1.14_1
Installing php5-xmlreader: 5.4.26
Installing php5-pdo_sqlite: 5.4.26
Installing php5-extensions: 1.7
Installing mysql56-client: 5.6.16_1
Installing mysql56-server: 5.6.16
The installation will require 149 MB more space
14 MB to be downloaded
Proceed with installing packages [y/N]: y
安裝完後把服務加到系統啟動檔案裡:
# vi /etc/rc.conf
...
nginx_enable="YES"
php_fpm_enable="YES"
mysql_enable="YES"
配置Mysql:
# vi /usr/local/etc/my.cnf
[mysqld]
socket = /tmp/mysql.sock
skip-networking
skip-name-resolve
# service mysql-server start
# /usr/local/bin/mysqladmin -u root password `password`
配置 PHP 和 PHP-FPM,這裡不需要配啥,預設的配置就行:
# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
# vi /usr/local/etc/php.ini
# vi /usr/local/etc/php-fpm.conf
# service php-fpm start
配置 APC:
# echo `apc.enabled="1"` >> /usr/local/etc/php.ini
# echo `apc.shm_size="32M"` >> /usr/local/etc/php.ini
# service php-fpm restart
配置 Nginx:
# vi /usr/local/etc/nginx/nginx.conf
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /usr/local/www/nginx;
index index.html index.htm;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root /usr/local/www/nginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
# service nginx start
寫個 phpinfo() 頁面測試一下 Nginx/PHP/PHP-FPM/APC 組合是否能正常工作。如果一切正常的話訪問 http://localhost/info.php 能看到 PHP 環境詳細資訊:
# vi /usr/local/www/nginx/info.php
<?php phpinfo(); ?>
參考:http://www.vpsee.com/2014/04/install-nginx-php-apc-mysql-on-freebsd-10-0/
相關文章
- FreeBSD安裝與配置概述(轉)
- freebsd從安裝到想要的狀態配置
- FreeBSD下安裝配置Hadoop叢集(三)Hadoop
- FreeBSD安裝VMTools
- Freebsd P怎麼安裝?Freebsd PF 安裝使用詳解
- FreeBSD安裝samba(轉)Samba
- FreeBSD下安裝配置Hadoop叢集(效能調優)Hadoop
- Freebsd 下安裝squidUI
- FreeBSD下安裝GNOME桌面(轉)
- FreeBSD系統上如何安裝Bugzilla?FreeBSD系統安裝Bugzilla的方法教程
- freebsd7.0安裝cacti手冊
- FreeBSD安裝檔案系統(轉)
- FreeBSD編譯安裝新核心(轉)編譯
- FreeBSD手工編譯安裝程式(轉)編譯
- 在FreeBSD中安裝MySQL資料庫MySql資料庫
- 在 FreeBSD 10.1中安裝 Mate 桌面
- 使用FreeBSD的ports安裝hadoop薦Hadoop
- 在FreeBSD上安裝Linuxigd(轉)Linux
- FreeBSD安裝之自動分割槽(轉)
- 配置FreeBSD核心(轉)
- FreeBSD虛擬機器 VMware Tools 安裝教程虛擬機
- 如何在FreeBSD中安裝Nginx,MySQL,PHP(FEMP)NginxMySqlPHP
- 本地windows搭建spark環境,安裝與詳細配置(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)WindowsSparkJDKHadoop
- FreeBSD 系統的配置.
- 如何在FreeBSD 13中安裝MySQL資料庫MySql資料庫
- FreeBSD下安裝Apache+PHP+MySQL+Tomcat(轉)ApachePHPMySqlTomcat
- 在FreeBSD中安裝雙網路卡例項(轉)
- zabbix安裝—–nginx安裝和配置Nginx
- FreeBSD系統下安裝字型的步驟詳解
- 如何在樹莓派 2B 上安裝 FreeBSD樹莓派
- FreeBSD下安裝MySQL+Apache+PHP新手指南(轉)MySqlApachePHP
- 多系統安裝實踐(Window /FreeBSD/Linux)(轉)Linux
- 如何在 FreeBSD 10.2 上安裝使用 Nginx 的 GhostNginx
- Zookeeper 安裝配置
- 【mongodb安裝配置】MongoDB
- ceph安裝配置
- ELK 安裝配置
- Prometheus安裝配置Prometheus