环境安装脚本
LNP 环境
Nginx + PHP + Composer + Supervisor
适用于 Laravel 环境
- 包含内容: Nginx, PHP 7.2, Composer, Supervisor
- PHP 模块: fileinfo, imap, ldap, redis, memcached, swoole
安装
# 安装 Nginx + PHP,以下4行要全部复制一起执行
wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz \
&& tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh \
--nginx_option 1 --php_option 7 --phpcache_option 1 \
--php_extensions fileinfo,imap,ldap,redis,memcached,swoole
# 安装 Composer
yum install composer
# 安装 Supervisor
yum install supervisor
服务管理
# 注册服务
systemctl enable nginx
systemctl enable php-fpm
systemctl enable supervisor
# 启动服务
systemctl start nginx
systemctl start php-fpm
systemctl start supervisor
# 重启服务
systemctl restart nginx
systemctl restart php-fpm
systemctl restart supervisor
# 查看服务状态
systemctl status nginx
systemctl status php-fpm
systemctl status supervisor
PHP 模块及配置
按需添加模块
# 首先进入 oneinstack 目录,然后执行
## 添加 redis
./install.sh --php_extensions redis
## 添加 swoole
./install.sh --php_extensions swoole
## 添加 fileinfo
./install.sh --php_extensions fileinfo
启用 proc_open
;; Laravel schedule 需要系统进程权限 proc_open, proc_get_status
;; 找到
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
;; 改为
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
参考
- 交互安装 – https://oneinstack.com/install/
- 自动安装 – https://oneinstack.com/auto/
安装 Nginx
;PHP 版本选择 7.3;PHP 扩展选择 imagick
,fileinfo
,imap
,ldap
,redis
,swoole
;不装数据库;其他功能不安装。
如果之前没有安装组件,后续补充安装,统一入口为
./install.sh
,
addons.sh
脚本不再提供,如之前没有安装
php redis
扩展,补充安装命令:./install.sh --php_extensions redis
如之前没有安装
php fileinfo
扩展,补充安装命令:./install.sh --php_extensions fileinfo