我在ubuntu16.04中安装了nginx,并检查配置文件位置为/etc/nginx/conf/nginx.conf
$ /usr/sbin/nginx -V 2>&1 | grep --colour=auto conf然后显示配置文件路径:
--conf-path=/etc/nginx/nginx.conf我正在安装openam nginx_agent 链接,这个nginx_agent有一个nginx.conf文件
/opt/nginx_agent /opt/nginx_agent/conf/nginx.confnginx_web_agent使用nginx.conf文件,
如何将nginx默认nginx.conf文件更改为nginx_web_agent nginx.conf文件
例如:
nginx配置使用/opt/nginx_agent/conf/nginx.conf代替/etc/nginx/nginx.conf
建议我怎么做?
发布于 2016-12-17 08:47:16
/usr/sbin/nginx -V显示初始配置脚本参数,而不一定显示正在运行的实际参数。
要使用替代配置文件,可以设置-c标志(曼尼克斯),而不是默认配置文件:
/usr/sbin/nginx -c /opt/nginx_agent/conf/nginx.confUbuntu16.04使用systemd管理服务,因此需要更改nginx服务的systemd参数:
/lib/systemd/system/nginx.service-c标志: ExecStartPre=/usr/sbin/nginx -t -c /opt/nginx_agent/conf/nginx.conf -q -g‘守护进程on;master_process on;’ExecStart=/usr/sbin/nginx -c /opt/nginx_agent/conf/nginx.conf -g‘守护进程;master_process;’ExecReload=/usr/sbin/nginx -c /opt/nginx_agent/conf/nginx.conf -g‘守护进程;master_process on;’-s重载‘systemd管理器配置:systemctl daemon-reloadnginx服务:服务nginxnginx服务参数: systemctl状态nginx.service . 2411 nginx:主进程/usr/sbin/nginx -c /opt/nginx_agent/conf/nginx.conf -g守护进程;master_process on .我就是这样做的。
https://serverfault.com/questions/821284
复制相似问题