bsd / 未分类 · 2015年5月25日

freesbsd ports 安装 nginx+mariadb(mysql分支) +php

ps 2015 准备更新 一下 基于 freebsd 10.1
因为各种原因特别想用绝对自由 这里没有mysql 而是用mariadb
开始
首先是更新ports
portsnap fetch extract #第一次更新时用,直接下载ports并且解压
portsnap fetch update #以后更新时使用
portsnap extract

1.#安装nginx
cd /usr/ports/www/nginx
make config-recursive
make install clean

2.#安装php
cd /usr/ports/lang/php5
#在php5-extensions的config页面中,需要勾选PHP-FPM项。
make config-recursive
make install clean
cd /usr/ports/lang/php5-extensions/
#您的PHP似乎没有安装运行WordPress所必需的MySQL扩展
#这个有些要选择一下下 支持mysql gd什么 MYSQL PDO_MYSQL
make config
make install clean

3.#安装mariadb
http://www.freshports.org/databases/mariadb-server
cd /usr/ports/databases/mariadb55-server/ && make config
make install clean
cp /usr/local/share/mysql/my-medium.cnf /var/db/mysql/my.cnf
echo 'mysql_enable="YES"' >> /etc/rc.conf
cat /etc/rc.conf
/usr/local/etc/rc.d/mysql-server start
mysql -uroot -p

4.#配置php
vi /usr/local/etc/php-fpm.conf
-; events.mechanism = epoll
+events.mechanism = kqueue
...
-listen = 127.0.0.1:9000
+listen = /var/run/php-fpm.sock
...
-;listen.owner = www
-;listen.group = www
-;listen.mode = 0666
+listen.owner = www
+listen.group = www
+listen.mode = 0666

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
echo 'php_fpm_enable="YES"' >> /etc/rc.conf
Start PHP-FPM:
Code:
# /usr/local/etc/rc.d/php-fpm start

Configure nginx
/usr/local/etc/rc.d/nginx restart
其它
添加root密码:
MariaDB [(none)]> set password for [email protected]=password('password'); 
Query OK, 0 rows affected (0.00 sec) 
# set root password 
MariaDB [(none)]> set password for [email protected]'127.0.0.1'=password('password'); 
Query OK, 0 rows affected (0.00 sec)

mysqladmin -u root password yourpassword
8、安装eaccelertor
cd /usr/ports/www/eaccelerator
make install clean
vi /usr/local/etc/php/extensions.ini
添加
extension=eaccelerator.so
安装Memcache扩展

cd /usr/ports/databases/pecl-memca
mkdir -p /usr/local/etc/nginx/logs
echo 'nginx_enable="YES"' >> /etc/rc.conf
echo 'php_fpm_enable="YES"' >> /etc/rc.conf

其它参考
安装与配置nginx下的php (PHP-FPM模式)
https://wiki.freebsdchina.org/howto/n/php_php-fpm_nginx
fnmp
http://forums.freebsd.org/showthread.php?t=30268
How to Install Nginx and PHP-FPM on FreeBSD
http://203.208.46.148/search?q=freebsd+nginx&ie=UTF-8&oe=UTF-8&hl=zh-CN&btnG=+Search+
http://bin63.com/how-to-install-nginx-and-php-fpm-on-freebsd
http://os.51cto.com/art/201101/244084_1.htm
http://www.yangjia.org/2013/01/25/%E5%B0%8F%E5%86%85%E5%AD%98-freebsd-%E4%BC%98%E5%8C%96%E5%8F%8A%E9%83%A8%E7%BD%B2-nmp.html
卸载
make deinstall clean
FreeBSD 的 Ports 系统
https://wiki.freebsdchina.org/faq/ports
FreeBSD 网络配置
https://wiki.freebsdchina.org/faq/networking
https://www.digitalocean.com/community/tutorials/how-to-install-an-nginx-mysql-and-php-femp-stack-on-freebsd-10-1
http://netkiller.github.io/journal/freebsd.php.html

#不错
http://forums.freebsd.org/showthread.php?p=213791
#这个源码的
http://www.excms.cn/manual/install-freebsd-nginx.html
https://hackademics.eu/repo/1/
http://bbs.linuxtone.org/thread-6474-1-1.html
freebsd desktop
https://wiki.freebsdchina.org/doc/d/freebsd_desktop
https://wiki.freebsdchina.org/software/v/virtualbox-additions