nginx迁移还访问原来的配置文件及log

nginx编译在/usr/local/nginx,现在要把nginx迁移到/home下,加参数运行问题如下 ./nginx -c /home/nginx/conf/nginx.conf nginx: [alert] could not open error log file: open() “/usr/local/nginx/logs/error.log” failed (2: No such file or directory) …

回复:关于这个问题其实非常简单我们用。./nginx -h 后可以看到帮助信息,有各种参数可以输入,这个问题就是-p
比如你编译的时候目录是/usr/local/ningx,现在你要迁移到/home/workspace/nginx下,你只要把编译后的包(包含lib bin include)的那个包,拷贝到/home/workspace/nginx下,然后修改权限(如果编译路径是/usr/local/ningx)
那么权限是root,修改后执行:

./nginx -p /home/workspace/nginx

就可以了,后面都不用跟-c 以及指定的conf路径了,一个-p直接就将路径全部改到现在home下边了。

原文链接:https://blog.csdn.net/weixin_43360707/article/details/109378469

 

posted @ 2021-12-28 09:19  疯靡  阅读(851)  评论(0)    收藏  举报