在vmware11中,安裝centos 7 minimal,編譯安裝的nginx 1.6.3,添加開機啟動不知道怎么回事,總是不行啊?
雖然centos 7 是用systemctl管理的了,但是我的mysql與php-fpm都能成功,但是nginx就是不行,不知道要怎樣才行,求大神。
如果你采用編譯安裝的方式,直接在/etc/rc.local 增加如下代碼即可:
/usr/local/nginx/sbin/nginx
前提是你的nginx是安裝到/usr/local/nginx 下
另外,如果使用yum 安裝的話,默認是作為服務器,開機自動啟動的??梢杂胏hkconfig 查看
如果在centos7中是用yum 安裝nginx,在/etc/init.d 是沒有它相關(guān)的文件的
直接用systemctl啟動就是:
sudo systemctl enable nginx
sudo systemctl start nginx
systemctl enable nginx.service
難道不行?會將所有級別生效?;蛘咄扑]下載sysv-rc-conf
開機自啟動Nginx服務:
sudo systemctl enable nginx.service
提示:ln -s '/usr/lib/systemd/system/nginx.service' '/etc/systemd/system/multi-user.target.wants/nginx.service'