linux中国网

菜菜鸟的linux杂记

fnmp(pkg)

首先添加一个普通帐号并加入到管理员组

root@freebsds # adduser
Username: eva
Login group is eva. Invite evan into other groups? []: wheel #一定要有这个

在你的freebsd首次使用portsnap必须执行下面2步:

portsnap fetch
portsnap extract
这2步可以合成使用:
portsnap fetch extract
portsnap fecth是从网上获取portsnap快照的最新压缩包,听闻这个压缩包官方每小时更新一次。
portsnap extract 则是把这个压缩包创立到/usr/ports。哪怕你以前已经手工安装了ports,他也会重新创立一次。

以后更新,只需要执行下面2步:
portsnap fetch
portsnap update
这2步可以合成使用:

[root@bsd01 ~]# portsnap fetch update
portsnap第一次运行extract命令时,可能需要一段时间,以后更新使用update的时候,速度就块很多了。

#Update all your ports

portsnap fetch update && portupgrade -a #第二个是没用的吧
#you must run ‘portsnap extract’ before running ‘portsnap update’.
portsnap extract && portsnap update
rehash

# 这里db 用mariadb ps mariadb 可见mariadb

#pkg upgrade
pkg install nginx mariadb100-server php56-extensions php56-bz2 php56-curl php56-exif php56-fileinfo php56-gd php56-mbstring php56-mcrypt php56-pdo_mysql php56-openssl php56-zip php56-zlib pecl-APCu pecl-intl

sysrc 'nginx_enable=YES' 'php_fpm_enable=YES' 'mysql_enable=YES'

#ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem

**********************
1.配置mariadb start
cp /usr/local/share/mysql/my-medium.cnf /usr/local/etc/my.cnf
cd /usr/local
mysql_install_db

#sysrc 已搞定了
#echo 'mysql_enable="YES"' >> /etc/rc.conf

service mysql-server onestart
/usr/local/bin/mysql_secure_installation

1.配置mariadb the end
**********************

**********************
2.配置php start

cd /usr/local/etc
vi php-fpm.conf

#ln 164
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock

#ln 176
;listen.owner = www
;listen.group = www
;listen.mode = 0660
#Enable these by removing the comment marker at the beginning:
listen.owner = www
listen.group = www
listen.mode = 0660

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

vi php.ini
#Uncomment the cig.fix_pathinfo line and set it to "0":
;cgi.fix_pathinfo=1
#772
cgi.fix_pathinfo=0
#Save and close the file when you are finished.

service php-fpm restart

2.配置php the end
PHP-FPM completely configured
**********************
3.Configure nginx start
service nginx start
cd /usr/local/etc/nginx
cp nginx.conf nginx.confbak
vi nginx.conf

mkdir -p /var/log/nginx
mkdir -p /data/www
chmod -R 0777 /data/www
chown -R www /data/www
mkdir -p /usr/local/etc/nginx/logs/
chown -R www /usr/local/etc/nginx/logs/
service nginx restart

root@free:/usr/local/etc # cat nginx/nginx.conf
user www;
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

pid logs/nginx.pid;

events {
use kqueue;#kqueue 是 FreeBSD 上的一种的多路复用机制
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

gzip on;

server {
listen 80;
server_name 192.168.1.161;
charset utf-8;
root /data/www;
index index.php index.html index.htm;
#access_log logs/host.access.log main;

location / {
try_files $uri $uri/ =404;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/www;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;

#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
}

}

}

cat hosts/wiki.conf
server {
listen 80;
server_name evanlinux.com;
charset utf-8;
access_log off;
root /data/wiki;
index index.php index.htm index.html;
location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ {
expires 7d;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}

3.Configure nginx the end

/usr/local/etc/rc.d/php-fpm start

CREATE DATABASE wordpress;
use mysql;
CREATE USER evan@localhost IDENTIFIED BY 'evan';
GRANT ALL PRIVILEGES ON wordpress.* TO evan@localhost;
FLUSH PRIVILEGES;

#https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-a-freebsd-10-1-server

ps 有时用wordpress 自己的导入功能文件太大

1.改 php.ini #xml 文件为66M左右
upload_max_filesize 改为80
post_max_size 改为 80

2. nginx.conf
找到http{}段,添加
client_max_body_size 80m;

重启NGINX
kill -HUP `cat /usr/local/etc/nginx/logs/nginx.pid `

Nginx出现“413 Request Entity Too Large”错误解决方法

默认upload_max_filesize = 2M,即文件上传的大小为2M,如果你想上传超过8M的文件,比如20M,你必须设定upload_max_filesize = 20M。
  但是光设置upload_max_filesize = 20M还是无法实现大文件的上传功能,你必须修改php.ini配置文件中的post_max_size选项,其代表允许POST的数据最大字节长度,默认为8M。如果POST数据超出限制,那么$_POST和$_FILES将会为空。要上传大文件,你必须设定该选项值大于upload_max_filesize指令的值,我一般设定upload_max_filesize和post_max_size值相等。另外如果启用了内存限制,那么该值应当小于memory_limit选项的值。

mysqldump –default-character-set=utf8 -uroot -pevan wordpress >wpnow.sql

**********************
老是403 记住真的的权限问题 要8进制 亲

这样就搞定了
chmod -R 0777 /data/www/

安装完 WordPress 后你应该做好这24件事
http://www.chinaz.com/web/2014/0627/357330.shtml

http://www.vpsee.com/2014/04/install-nginx-php-apc-mysql-on-freebsd-10-0/

http://www.linuxchina.net/?p=1722

How To Install WordPress with Nginx on a FreeBSD 10.1 Server

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-a-freebsd-10-1-server

##参考这个
Howto Install and Configure FEMP Stack (FreeBSD 10.2, Nginx, MariaDB, PHP)

How To Install an Nginx, MySQL, and PHP (FEMP) Stack on FreeBSD 10.1

How To Install WordPress with Nginx on a FreeBSD 10.1 Server
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-a-freebsd-10-1-server

如何 evan su root

如何添加key

自己的机器 没事 pkg install vim

conf 配置文件一般 在 /usr/local/etc/

/usr/local/etc/nginx

http://www.linuxchina.net/?p=1722
18:49 portsnap fetch
12 18:56 portsnap extract
13 19:07 portsnap update
14 19:07 portsnap fetch extract
15 19:21 portsnap fetch update

#30号
pkg install databases/mariadb100-server

freenas like
https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/

#err 没有; 结束
root@free:/usr/local/etc/nginx # service nginx restart
Performing sanity check on nginx configuration:
nginx: [emerg] directive “index” is not terminated by “;” in /usr/local/etc/nginx/nginx.conf:43
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed

FreeBSD 10 编译 Nginx, PHP, MariaDB
http://my.oschina.net/jarly/blog/195331

FreeBSD 10 Mariadb Server Install Command

https://www.digitalocean.com/community/tutorials/how-to-install-an-nginx-mysql-and-php-femp-stack-on-freebsd-10-1
https://www.freebsdnews.com/2015/01/15/freebsd-10-mariadb-server-install-command/
http://www.vpsee.com/2014/04/install-nginx-php-apc-mysql-on-freebsd-10-0/
http://www.rasyid.net/2014/10/09/how-to-install-mariadb-10-on-freebsd-10/

http://www.tuicool.com/articles/6jQ3qiF
http://www.unixmen.com/install-apache-mariadb-php-freebsd10/

https://fosskb.wordpress.com/2014/04/12/famp-installing-apache2-4-mariadb-php-on-freebsd-10/

http://www.rasyid.net/2010/11/07/how-to-install-mariadb-on-freebsd/

http://www.cyberciti.biz/faq/how-to-install-mariadb-databases-on-a-freebsd-v10-unix-server/
https://forums.freebsd.org/threads/mariadb-in-freebsd.48133/

maridb
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
http://blog.csdn.net/wyzxg/article/details/4720041

http://www.360doc.com/content/08/0215/16/25127_1045525.shtml

ports install err 不能启动
failed precmd routine for mysql

FreeBSD 10.0 与 pkg 时代的到来

pkg delete curl

评论已关闭。