查看服務
首先查看 nginx 的服務狀態,輸入?systemctl status nginx,結果如下
沒有找到相關的服務,下一步就是添加系統服務。
添加系統服務
在?/usr/lib/systemd/system?目錄中添加?nginx.service,根據實際情況進行修改,詳細解析可查看下方參考資料中的文章。內容如下
[unit] description=nginx?-?high?performance?web?server documentation=http://nginx.org/en/docs/ after=network.target?remote-fs.target?nss-lookup.target ? [service] type=forking pidfile=/usr/local/nginx/logs/nginx.pid execstartpre=/usr/local/nginx/sbin/nginx?-t?-c?/usr/local/nginx/conf/nginx.conf execstart=/usr/local/nginx/sbin/nginx?-c?/usr/local/nginx/conf/nginx.conf execreload=/bin/kill?-s?hup?$mainpid execstop=/bin/kill?-s?quit?$mainpid privatetmp=true ? [install] wantedby=multi-user.target
添加完成后再來看下
設置開機自動啟動
首先測試一下,重啟然后來查看 nginx 服務
確實沒有啟動。輸入?systemctl start nginx?啟動
可以使用?systemctl?啟動,說明之前添加的?nginx.service?沒有問題。然后輸入?systemctl enable nginx?設置開機啟動
最后重啟檢查下是否設置成功
沒有問題,到此關于 nginx 的編譯安裝完成,接下來是 php 的安裝。
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END