重啟Linux系統(tǒng)后,配置環(huán)境需要重啟
重啟 Nginx授舟。
重啟命令是:
/usr/local/nginx/sbin/nginx -s reload
端口被占用:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
執(zhí)行殺掉進(jìn)程:
killall -9 nginx
啟動(dòng):
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
結(jié)束
重啟mysql
[root@VM_0_16_centos ~]# service mysql restart
啟動(dòng)失敗:
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
根據(jù)提示,"/var/run/mysqld/mysqld.pid"該路徑文件的問(wèn)題
強(qiáng)制重啟系統(tǒng)后導(dǎo)致mysqld/mysqld.pid丟失
創(chuàng)建相關(guān)文件
[root@VM_0_16_centos run]# mkdir /var/run/mysqld
[root@VM_0_16_centos run]# vim /var/run/mysqld/mysqld.pid
設(shè)置權(quán)限
[root@VM_0_16_centos run]# chown -R mysql /var/run/mysqld/
[root@VM_0_16_centos run]# chgrp -R mysql /var/run/mysqld/
[root@VM_0_16_centos run]# chown -R mysql.mysql /usr/local/mysql/
[root@VM_0_16_centos run]# chgrp -R mysql /usr/local/mysql/
再次重啟
[root@VM_0_16_centos run]# service mysql restart
ERROR! MySQL server process # is not running!
Starting MySQL. SUCCESS!
重啟php
啟動(dòng)php-fpm:
方式一:
/etc/init.d/php-fpm start
重新啟動(dòng)php-fpm:
方式二:
service php-fpm restart
成功后再 重新啟動(dòng)nginx
(如果失敗
Failed to start php-fpm.service: Unit php-fpm.service not found.
往下走):
重新啟動(dòng)nginx
service nginx restart
重新啟動(dòng)nginx
如果沒有配置的上面命令執(zhí)行會(huì)失敗,使用下面安裝路徑啟動(dòng):
/usr/local/nginx/sbin/nginx -s reload
如果已經(jīng)啟動(dòng),報(bào)錯(cuò)的話,需要?dú)⒌暨M(jìn)程再執(zhí)行:
unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
查看進(jìn)程():
netstat -nldp |grep 9000
返回信息:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 20016/php-fpm: mast
殺掉進(jìn)程():
kill 20016
關(guān)于9000端口被占用的情況:
正常被php-fpm占用可以通過(guò)殺掉進(jìn)程來(lái)解決,
但是如果php-fpm沒有進(jìn)程:
[root@VM_0_17_centos php]# /etc/init.d/php-fpm start
Starting php-fpm [29-Dec-2018 12:25:57] ERROR: unable to bind listening socket for address '127.0.0.1:9000':
Address already in use (98)
[29-Dec-2018 12:25:57] ERROR: FPM initialization failed
failed
[root@VM_0_17_centos php]# killall php-fpm
php-fpm: no process found
也就是端口被占用無(wú)法啟動(dòng),但是又沒有查詢到有進(jìn)程的死循環(huán)狀態(tài)(php無(wú)法訪問(wèn),報(bào)錯(cuò)504 timeout , 但是可以訪問(wèn)靜態(tài)頁(yè)面)
本人網(wǎng)上搜索了一下方法,沒有成功,
最終選擇: 重啟系統(tǒng) !
查看日志中顯示子線程不夠:
WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
默認(rèn)安裝路徑/usr/local/php/etc/php-fpm.d/www.conf里
設(shè)置pm.max_children = 300