Geben Sie beim Start von Nginx ein Präfix an
天蓬老师
天蓬老师 2017-05-16 17:25:25
0
3
606

Mein Nginx ist kompiliert und in configure的时候指定的prefix(/etc/nginx)。但是我部署nginx的时候的目录不是configure时配置的prefix wird ein Fehler gemeldet:

正在启动 nginx:nginx: [alert] could not open error log file: open() "/etc/nginx/logs/error.log" failed (2: No such file or directory)
2014/10/28 17:56:16 [emerg] 5529#0: mkdir() "/etc/nginx/cache/client_temp" failed (2: No such file or directory)

Ich möchte es automatisch in ein neues Verzeichnis verschieben lassen, ohne es neu zu kompilieren. Das neue Verzeichnis ist /etc/nginx2有没有可能在启动时指定prefix. Meine Kompilierungsparameter sind ungefähr:

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
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

Antworte allen(3)
phpcn_u1582

1、 从错误提示看,猜测是 /etc/nginx 不存在。 建议试检查 access_log 和 error_log 配置项;
2、谁编译谁执行,不要在A机器编译,在B机器执行;
3、 /etc 一般不用来存放程序,可以使用 /opt 。

给我你的怀抱

nginx执行可以使用-c指定配置文件,拿你的配置来说,比如酱紫/etc/nginx/sbin/nginx -c /link/nginx.confnginx.conf中指定其他内容的路径即可。


/etc目录一般存放的是软件配置文件

左手右手慢动作

编辑init.d下的启动文件,指定nginx的启动工作环境

/usr/sbin/nginx -p $BASE_DIR/usr/local/nginx_newdir

或者指定配置文件

/usr/sbin/nginx -c $BASE_DIR/etc/nginx/nginx.conf 

当然,你可以两个参数一起用。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!