oneinstack 安装 Nginx 失败 No such file or directory

oneinstack 安装 Nginx 失败原因排查

问题描述

今天在复现尚硅谷Nginx教学的过程中,需要试用oneinstack安装ECS的环境。链接: 尚硅谷Nginx

oneinstack自动安装命令:

wget -c http://mirrors.oneinstack.com/oneinstack.tar.gz && tar xzf oneinstack.tar.gz && ./oneinstack/install.sh --nginx_option 1 --php_option 9 --db_option 2 --dbinstallmethod 1 --dbrootpwd oneinstack --firewall  --reboot 

在安装过程Nginx启动失败。
/usr/local下无nginx相关目录。
重新试用oneinstack命令安装:

./oneinstack/install.sh --nginx_option 1

发现报错信息:

Nginx installed successfully!
mv: cannot stat ‘/usr/local/nginx/conf/nginx.conf’: No such file or directory
/bin/cp: cannot create regular file ‘/usr/local/nginx/conf/nginx.conf’: No such file or directory
include/nginx.sh: line 60: /usr/local/nginx/conf/proxy.conf: No such file or directory
sed: can't read /usr/local/nginx/conf/nginx.conf: No such file or directory
sed: can't read /usr/local/nginx/conf/nginx.conf: No such file or directory
sed: can't read /usr/local/nginx/conf/nginx.conf: No such file or directory
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

问题原因

/oneinstack/include/nginx.sh脚本处发现:

  ./configure --prefix=${nginx_install_dir} --user=${run_user} --group=${run_group} --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-${openssl11_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-ld-opt='-ljemalloc' ${nginx_modules_options}
  make -j ${THREAD} && make install
  if [ -e "${nginx_install_dir}/conf/nginx.conf" ]; then
    popd > /dev/null
    # 问题原因:安装成功后仍然删除 ${nginx_install_dir}* 下的所有内容!
    rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* nginx-${nginx_ver}* ${nginx_install_dir}*
    echo "${CSUCCESS}Nginx installed successfully! ${CEND}"
  else
    rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* nginx-${nginx_ver}* ${nginx_install_dir}*
    echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}"
    kill -9 $$; exit 1;
  fi

nginx_install_dir 的配置可以在/oneinstack/options.conf l里可以找到

nginx_install_dir=/usr/local/nginx

正是我们习惯安装的nginx目录。

因此断定问题原因:安装成功后仍然删除 ${nginx_install_dir}* 下的所有内容!导致后续脚本执行失败,找不到文件!严重怀疑作者摸鱼粘错了!没有检验!

解决方案

手动将安装脚本/oneinstack/include/nginx.sh的错误行更换为:

rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* nginx-${nginx_ver}*

取消目录的删除即可!
更换后重新执行:

./oneinstack/install.sh --nginx_option 1

安装成功!

总结

还是比较坑的!感觉像在帮作者改bug!作为一个这么多人知道的开源项目实在不应该犯这种错误,这增加了好多人的排错时间。官网上没有预留提问和反馈窗口!在这里先记录了,希望作者能知道或者有人能转告一下!毕竟还是挺花费时间的!选择oneinstack就是图省事,结果还花大量时间排错实在是南辕北辙!

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值