Linux下LNMP启动不了的问题总结(2015.05)

【1】

*****@*****-VirtualBox:~$ sudo /etc/init.d/mysql.server start

Starting MySQL

 * Couldn't find MySQL server (/usr/bin/mysqld_safe)

 

解决方案:

rm /etc/mysql/my.cnf

 

【2】

Warning: World-writable config file '/usr/local/server/mysql/my.cnf' is ignored

原因是my.cnf权限设置的太大,mysql忽略了my.cnf配置文件,采取的默认参数启动的

chmod 644 my.cnf

 

【3】启动MySQL:

* MySQL server PID file could not be found!

Starting MySQL

......................................... ...................

 

然后使用 ps aux |grep mysq* 

看到如下:

root     10274  0.0  0.0  68160  1336 ?        S    13:43   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/irxpert-test.pid

mysql    10353  0.0  1.0 344360 39464 ?        Sl   13:43   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/irxpert-test.err --pid-file=/var/lib/mysql/irxpert-test.pid

root     11884  0.0  0.0  63384   760 pts/1    S+   15:44   0:00 grep mysq*

如果看到上面的内容,那说明,Mysql的进程卡死了,这时用就要把这些卡死的进程都关闭

pgrep mysql  ,把看到的进程kill掉,就可以了。

 

--------------------------------------------------------------------------------------

【PHP】

Starting php-fpm [22-May-2015 15:17:59] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)

[22-May-2015 15:17:59] ERROR: FPM initialization failed

 failed

 

解决办法:端口被占用了,使用如下:

1.查看端口应用:# netstat -lnp|grep 9000,获得pid或应用名称。

2.关闭端口应用:# kill -9 <pid>或者# pkill <应用名称>。 

3.killall php-fpm (不知道是否可行,暂时标记下来)

[补充,2015年5月24日 11:13:04]

今天启动php-fpm又出同样的问题了,解决办法总结如下:

 

使用 kill -9 3087 后还是不行,

最后使用:pkill java 问题解决!

 

--------------------------------------------------------------------------------------

【Nginx】

nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13:Permission denied)

原因:当前用户对该位置没有写入权限

解决办法:

1.使用命令:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 以root权限启动

2.使用命令:sudo chmod -R a+rw /usr/local/nginx 给所有用户赋权限(个人学习,不考虑安全问题)

                    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  启动Nginx

 

注: 以非root权限启动时,会出现 nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 错误

原因: Linux只有root用户可以使用1024一下的端口

解决办法:1.已root权限启动

  2.将 /usr/local/nginx/conf/nginx.conf 文件中的80端口改为1024以上

server {

# listen 80

   listen 8080

……

}


--------------------------------------------------------------------------------------

 

原文地址:https://www.cnblogs.com/rxbook/p/5994310.html