为了账号安全,请及时绑定邮箱和手机立即绑定

nginx启动时指定prefix

nginx启动时指定prefix

蛊毒传说 2019-04-16 20:27:55
我的nginx是编译好的,在configure的时候指定的prefix(/etc/nginx)。但是我部署nginx的时候的目录不是configure时配置的prefix,于是会报错:正在启动nginx:nginx:[alert]couldnotopenerrorlogfile:open()"/etc/nginx/logs/error.log"failed(2:Nosuchfileordirectory)2014/10/2817:56:16[emerg]5529#0:mkdir()"/etc/nginx/cache/client_temp"failed(2:Nosuchfileordirectory)我想在不重新编译的情况下,让它自动去新的目录下面,新的目录是/etc/nginx2。有没有可能在启动时指定prefix。我的编译参数大致是:auto/configure--prefix="/etc/nginx"--with-debug--user=nginx--group=nginx--error-log-path="logs/error.log"--http-log-path="logs/access.log"--with-http_realip_module--with-http_addition_module--with-http_sub_module--with-http_dav_module--with-http_flv_module--with-http_mp4_module--with-http_random_index_module--with-http_secure_link_module--with-http_stub_status_module--http-client-body-temp-path=cache/client_temp--http-proxy-temp-path=cache/proxy_temp--http-fastcgi-temp-path=cache/fastcgi_temp--http-scgi-temp-path=cache/scgi_temp--http-uwsgi-temp-path=cache/uwsgi_temp--with-pcre=linux/pcre-8.35--with-zlib=linux/zlib-1.2.8
查看完整描述

2 回答

?
杨__羊羊

TA贡献1943条经验 获得超7个赞

1、从错误提示看,猜测是/etc/nginx不存在。建议试检查access_log和error_log配置项;
2、谁编译谁执行,不要在A机器编译,在B机器执行;
3、/etc一般不用来存放程序,可以使用/opt。
                            
查看完整回答
反对 回复 2019-04-16
?
当年话下

TA贡献1890条经验 获得超9个赞

nginx执行可以使用-c指定配置文件,拿你的配置来说,比如酱紫/etc/nginx/sbin/nginx-c/link/nginx.conf在nginx.conf中指定其他内容的路径即可。
/etc目录一般存放的是软件配置文件
                            
查看完整回答
反对 回复 2019-04-16
  • 2 回答
  • 0 关注
  • 2108 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号