访问https://lnmp.org/install.html按照步骤安装
当下载执行完
wget -c http://soft.vpser.net/lnmp/lnmp1.3.tar.gz && tar zxf lnmp1.3.tar.gz && cd lnmp1.3 && ./install.shlnmp
要到.install.sh下改一下下载地址,把http直接更换成ftp即可
Nginx状态管理:/etc/init.d/nginx {start|stop|reload|restart}
MySQL状态管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}lnmp {start|stop|reload|restart|kill|status}
目录结构:
Nginx 目录: /usr/local/nginx/
MySQL 目录 : /usr/local/mysql/
MySQL数据库所在目录:/usr/local/mysql/var/
MariaDB 目录 : /usr/local/mariadb/
MariaDB数据库所在目录:/usr/local/mariadb/var/
PHP目录 : /usr/local/php/
配置文件:
Nginx主配置(默认虚拟主机)文件:/usr/local/nginx/conf/nginx.conf
添加的虚拟主机配置文件:/usr/local/nginx/conf/vhost/域名.conf
MySQL配置文件:/etc/my.cnf
PHP配置文件:/usr/local/php/etc/php.ini
第一:更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称'%'。
或者新加条记录,“host” 项为要访问的ip地址,并授权。重启mysql服务。
第二:在系统防火墙添加例外端口:3306,并允许例外。
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
将3306添加到防火墙
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT