Linux 系统上 LNMP 架构搭建

LNMP架构,即 Linux系统下Nginx+MySQL+PHP这种网站服务器架构。

这里我们使用LNMP一键安装包安装,官网:https://lnmp.org/

下载安装

命令行执行:

wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp

数据库版本选择

输入数字选择数据库版本,其中mysql 5.6,5.7,MariaDB10均需要内存大于1GB,请自行衡量;

选择以后出现 Please enter: ,意思是设置MySQL 密码,不输入默认为root;

然后让你选择是否开启InnoDB引擎,默认开启,直接输入Y。

PHP版本选择

操作同上,输入数字选择版本。

开始安装

提示"Press any key to install...or Press Ctrl+c to cancel"后,按回车键确认开始安装。
LNMP脚本就会自动安装编译Nginx、MySQL、PHP、phpMyAdmin、Zend Optimizer这几个软件。

完成安装后提示:

============================== Check install ==============================
Checking ...
Nginx: OK
MySQL: OK
PHP: OK
PHP-FPM: OK

使用说明

lnmp操作:

lnmp {start|stop|reload|restart|kill|status}  

访问地址:

phpMyAdmin: http://IP/phpmyadmin/     
phpinfo:     http://IP/phpinfo.php                                  
Prober:      http://IP/p.php 

默认路径:

安装路径

/usr/local/

网站路径

/home/wwwroot/default

坑点

安装后MySQL无法远程连接,尝试开启端口,关闭防火墙,授权远程登录均无效。

查阅官方论坛说,为了安全lnmp会禁止远程连接MySQL,需要在iptables 中删除3306端口的规则…

操作如下

# 将所有iptables以序号标记显示,执行:
iptables -L -n --line-numbers

# 比如要删除INPUT里序号为8的规则(要删除OUTPUT的话就改成OUTPUT,以此类推),执行:
iptables -D INPUT 8

本文链接: https://jianz.xyz/index.php/archives/66/

1 + 3 =
19 评论
    alexChrome 84Windows 10
    2020年09月02日 回复

    ?

    3Quark BrowserAndroid
    2020年09月03日 回复

    5555

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    1748325910Chrome 85Windows 10
    2020年09月07日 回复

    你好

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 85Windows 10
    2020年09月07日 回复

    说点啥呢

    alexChrome 87Windows 10
    2020年12月05日 回复

    123