在 CentOS 安装了 Nginx,每次都是通过 /usr/local/nginx/html/nginx 命令来启动,我想设置为开机自动启动该服务,在网上搜到:chkconfig --level 345 nginx on
可是运行后却提示:在 nginx 服务中读取信息时出错:没有那个文件或目录
请问这是什么意思呢?要怎么弄才行,请教下各位,谢谢了~
phpcn_u15822017-04-24 16:01:14
chkconfig --level 345 nginx on For this command, you must first have the nginx startup configuration file under /etc/init.d. There are many such configuration files on the Internet. But this configuration file needs to be adjusted accordingly with the directory of your nginx program and the directory of the configuration file.
My opinion is to simply write /usr/local/nginx/html/nginx into /etc/rc.local. It will also be started at boot, but it will be executed after the programs in the respective levels are started. The effect is the same, and other programs will basically not rely on nginx to start.