过程:
1.pkg install nginx # 安装 nginx-1.14
2.pkg install mysql57-server # 安装 mysql server 5.7
3.pkg install php71 php71-curl php71-gd php71-mbstring php71-mcrypt php71-mysqli php71-openssl php71-pdo_mysql php71-xml # 安装 php7.1 和相关模块
4.vi /usr/local/etc/nginx/nginx.conf # 编辑nginx配置文件,添加站点,如本例添加drs2.anqun.org的https站点
server {
listen 443 ssl;
server_name drs2.anqun.org;
ssl_certificate ssl/drs2.anqun.org.pem;
ssl_certificate_key ssl/drs2.anqun.org.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root /usr/local/www/nginx/drs2.anqun.org;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root drs2.anqun.org;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx/drs2.anqun.org/$fastcgi_script_name;
include fastcgi_params;
}
}
5.sysrc nginx_enable=yes # 允许 nginx 服务
6.sysrc mysql_enable=yes # 允许 mysql 服务
7.sysrc php_fpm_enable=yes # 允许 php-fpm 服务
8.service nginx start # 启动 nginx 服务
9.service mysql-server start # 启动 nginx 服务
10.service php-fpm start # 启动 nginx 服务
11.ALTER USER 'root'@'localhost' IDENTIFIED BY 'niDEpASSWORD' ; # 首次启动mysql5.7后,root的密码会写在/root/.mysql_secret 文件里,需要用 ALTER USER 命令更改密码后使用
12.phpinfo显示信息
13.wordpress安装效果
参考:https://www.digitalocean.com/community/tutorials/how-to-install-an-apache-mysql-and-php-famp-stack-on-freebsd-10-1