Linux网络服务之快速搭建LNMP

一、环境准备

1、准备云服务器、公网ip、和域名,推荐用国外的,在国内使用服务器、公网ip和域名都需要备案的。

二、环境搭建

1、下载lnmp脚本并且执行。

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

2、选择第7个。

+------------------------------------------------------------------------+
|          LNMP V1.8 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|        A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux       |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
You have 11 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.62 (Default)
3: Install MySQL 5.6.51
4: Install MySQL 5.7.34
5: Install MySQL 8.0.25
6: Install MariaDB 5.5.68
7: Install MariaDB 10.1.48
8: Install MariaDB 10.2.38
9: Install MariaDB 10.3.29
10: Install MariaDB 10.4.19
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0): 7
You will install MariaDB 10.1.48
===========================
Please setup root password of MySQL.
Please enter: 123.com
MySQL root password:                                           \\必须要填写密码
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: y
You will enable the InnoDB Storage Engine

3、安装PHP

You have 9 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38
5: Install PHP 5.6.40 (Default)
6: Install PHP 7.0.33
7: Install PHP 7.1.33
8: Install PHP 7.2.34
9: Install PHP 7.3.29
10: Install PHP 7.4.21
11: Install PHP 8.0.8
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11): 6       \\填写第6个,因为WordPress支持php7的版本
You will install PHP 7.0.33
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3):                                  \\直接回车
No input,You will not install Memory Allocator.

Press any key to install...or Press Ctrl+c to cancel             \\直接回车,就执行安装了,然后打会儿游戏

4、安装完成后提示这个界面,并且访问一下是否正常。

Checking ...
Nginx: OK
MariaDB: OK
PHP: OK
PHP-FPM: OK
Clean Web Server src directory...
+------------------------------------------------------------------------+
|          LNMP V1.8 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
|    lnmp status manage: lnmp {start|stop|reload|restart|kill|status}    |
+------------------------------------------------------------------------+
|  phpMyAdmin: http://IP/phpmyadmin/                                     |
|  phpinfo: http://IP/phpinfo.php                                        |
|  Prober:  http://IP/p.php                                              |
+------------------------------------------------------------------------+
|  Add VirtualHost: lnmp vhost add                                       |
+------------------------------------------------------------------------+
|  Default directory: /home/wwwroot/default                              |
+------------------------------------------------------------------------+
|  MySQL/MariaDB root password: 123.com                          |
+------------------------------------------------------------------------+
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
nginx (pid 7532) is running...
php-fpm is runing!
 SUCCESS! MariaDB running (7888)
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port
LISTEN     0      128          *:80                       *:*
LISTEN     0      128          *:22                       *:*
LISTEN     0      128         :::3306                    :::*
Install lnmp takes 45 minutes.
Install lnmp V1.8 completed! enjoy it.

三、用google浏览器访问测试,如果访问正常就没问题了。

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Docker Compose是一个用于定义和运行多个Docker容器的工具。通过使用Docker Compose,您可以快速搭建LNMPLinux、Nginx、MySQL、PHP)开发环境。下面是一个快速搭建LNMP开发环境的示例docker-compose.yml文件: ```yaml version: '3' services: nginx: image: nginx:latest ports: - 80:80 volumes: - ./nginx.conf:/etc/nginx/nginx.conf - ./html:/usr/share/nginx/html depends_on: - php php: image: php:7.4-fpm volumes: - ./php.ini:/usr/local/etc/php/php.ini - ./html:/var/www/html depends_on: - mysql mysql: image: mysql:latest ports: - 3306:3306 environment: - MYSQL_ROOT_PASSWORD=your_password volumes: - ./mysql:/var/lib/mysql ``` 在上面的示例中,我们定义了三个服务:nginx、php和mysql。nginx服务使用nginx:latest镜像,并将主机的80端口映射到容器的80端口。同时,我们将nginx.conf文件和html文件夹分别挂载到容器内的对应路径。php服务使用php:7.4-fpm镜像,并将php.ini文件和html文件夹挂载到容器内的对应路径。mysql服务使用mysql:latest镜像,并将主机的3306端口映射到容器的3306端口。我们还设置了MYSQL_ROOT_PASSWORD环境变量,并将mysql文件夹挂载到容器内的/var/lib/mysql路径。 要快速搭建LNMP开发环境,您只需在包含docker-compose.yml文件的目录中运行以下命令: ```shell docker-compose up -d ``` 这将启动所有定义的服务,并将它们放在后台运行。现在,您可以通过访问http://localhost来访问您的LNMP开发环境。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Small丿Rain丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值