寶塔面板nginx安裝后無(wú)法啟動(dòng)的解決方法
發(fā)表時(shí)間:2023-12-06 23:36:04 瀏覽:713 次
最近在安排完面板環(huán)境有,創(chuàng)建網(wǎng)址顯示
卸載后,重新安裝,但是nginx啟動(dòng)不了查看,/etc/rc.d/init.d/nginx文件空白,所以用了之前的正常的nginx文件復(fù)制了一份,解決
通常到這一步就解決了。
如果找不到正常的
下面給你復(fù)制一份:
#! /bin/sh # chkconfig: 2345 55 25 # Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and # run 'update-rc.d -f nginx defaults', or use the appropriate command on your # distro. For CentOS/Redhat run: 'chkconfig --add nginx' ### BEGIN INIT INFO # Provides: nginx # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon ### END INIT INFO # Author: licess # website: http://www.bt.cn PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=nginx NGINX_BIN=/www/server/nginx/sbin/$NAME CONFIGFILE=/www/server/nginx/conf/$NAME.conf PIDFILE=/www/server/nginx/logs/$NAME.pid ulimit -n 8192 case "$1" in start) echo -n "Starting $NAME... " if [ -f $PIDFILE ];then mPID=`cat $PIDFILE` isStart=`ps ax | awk '{ print $1 }' | grep -e "^${mPID}$"` if [ "$isStart" != '' ];then echo "$NAME (pid `pidof $NAME`) already running." exit 1 fi fi $NGINX_BIN -c $CONFIGFILE if [ "$?" != 0 ] ; then echo " failed" exit 1 else echo " done" fi ;; stop) echo -n "Stoping $NAME... " if [ -f $PIDFILE ];then mPID=`cat $PIDFILE` isStart=`ps ax | awk '{ print $1 }' | grep -e "^${mPID}$"` if [ "$isStart" = '' ];then echo "$NAME is not running." exit 1 fi else echo "$NAME is not running." exit 1 fi $NGINX_BIN -s stop if [ "$?" != 0 ] ; then echo " failed. Use force-quit" exit 1 else echo " done" fi ;; status) if [ -f $PIDFILE ];then mPID=`cat $PIDFILE` isStart=`ps ax | awk '{ print $1 }' | grep -e "^${mPID}$"` if [ "$isStart" != '' ];then echo "$NAME (pid `pidof $NAME`) already running." exit 1 else echo "$NAME is stopped" exit 0 fi else echo "$NAME is stopped" exit 0 fi ;; restart) $0 stop sleep 1 $0 start ;; reload) echo -n "Reload service $NAME... " if [ -f $PIDFILE ];then mPID=`cat $PIDFILE` isStart=`ps ax | awk '{ print $1 }' | grep -e "^${mPID}$"` if [ "$isStart" != '' ];then $NGINX_BIN -s reload echo " done" else echo "$NAME is not running, can't reload." exit 1 fi else echo "$NAME is not running, can't reload." exit 1 fi ;; configtest) echo -n "Test $NAME configure files... " $NGINX_BIN -t ;; *) echo "Usage: $0 {start|stop|restart|reload|status|configtest}" exit 1 ;; esac
寶塔面板里面的nginx安裝后無(wú)法啟動(dòng)的解決方法:當(dāng)我們安裝好寶塔面板和nginx后,有時(shí)發(fā)現(xiàn)nginx無(wú)法啟動(dòng),無(wú)論點(diǎn)擊啟動(dòng)、重啟還是重載配置都提示“nginx服務(wù)啟動(dòng)失敗”,這時(shí)該怎么辦呢?
造成這種情況的原因很多,這里分析詳細(xì)一下:
第一種情況,寶塔面板安裝完成后,安裝nginx出現(xiàn)一些小問(wèn)題,導(dǎo)致:/etc/rc.d/init.d/nginx文件空白,這樣就無(wú)法啟動(dòng)nginx,解決方法:從正常的寶塔環(huán)境下對(duì)應(yīng)目錄中復(fù)制一份nginx文件源碼到/etc/rc.d/init.d/nginx文件中保存即可,再啟動(dòng)nginx就可以了。
第二種情況,啟動(dòng)nginx報(bào)如下錯(cuò)誤:
/www/server/nginx/sbin/nginx: error while loading shared libraries: libgd.so.3: cannot open shared object file: No such file or directory
這種出錯(cuò)是缺少依賴的問(wèn)題,根據(jù)自身情況在ssh執(zhí)行如下命令:
缺失libgd.so.3
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gd-2.2.5-7.el8.x86_64.rpm
rpm -i --nodeps gd-2.2.5-7.el8.x86_64.rpm #忽略依賴安裝
缺失libXpm.so.4
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/libXpm-3.5.12-8.el8.x86_64.rpm
rpm -i libXpm-3.5.12-8.el8.x86_64.rpm
缺失libtiff.so.5
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/libtiff-4.0.9-20.el8.x86_64.rpm
rpm -i --nodeps libtiff-4.0.9-20.el8.x86_64.rpm
libjbig.so.2.1
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/jbigkit-libs-2.1-14.el8.x86_64.rpm
rpm -i jbigkit-libs-2.1-14.el8.x86_64.rpm
第三種情況,nginx防火墻和網(wǎng)站監(jiān)控報(bào)表與Nginx不太兼容
已知寶塔兩個(gè)插件: nginx防火墻和網(wǎng)站監(jiān)控報(bào)表與Nginx不太兼容。
如果先安裝了上面兩個(gè)插件,或者安裝好NGINX后再升級(jí)NGINX版本,很可能性就會(huì)出現(xiàn)nginx無(wú)法啟動(dòng)的情況。
1、更新了下Nginx,更新到1.18就發(fā)現(xiàn)nginx無(wú)法啟動(dòng)了。只要是點(diǎn)啟動(dòng)就會(huì)報(bào)以下錯(cuò)誤。
nginx: the configuration file /www/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed
解決方法:卸載寶塔免費(fèi)nginx防火墻及網(wǎng)站監(jiān)控報(bào)表
百度搜索推廣 |公司簡(jiǎn)介 |人才招聘 |付款方式 |聯(lián)系方式 | ||
恩施網(wǎng)絡(luò)公司-恩施市百捷在線網(wǎng)絡(luò)科技有限公司 Copyright ? 2012-2021 網(wǎng)址:www.inpursuitofexpression.com | ||
電話:15587589530 傳真:15587589530 聯(lián)系人:鄒經(jīng)理 | ||
地址:恩施市火車站萬(wàn)福國(guó)際寫(xiě)字樓613 Email:zou@esbaidu.com 備案號(hào):鄂ICP備16001060號(hào)-8 | ||
|