欢迎光临
我们一直在努力

项目实战:LNMP-电商平台-ECshop

文章目录

  • 项目实战:LNMP-电商平台-ECshop
    • ECshop介绍
    • ECshop部署
      • 节点规划
      • 准备 LNMP 环境
        • 准备 Nginx
        • 准备 Mariadb
        • 准备 PHP
      • 准备数据库
      • 准备 ecshop 站点
    • ECshop 配置
    • ECshop 访问

项目实战:LNMP-电商平台-ECshop

ECshop介绍

ECShop 多场景在线商城。

用centos7模板克隆一台server

ECshop部署

节点规划

节点名称节点 IP节点功能
ecshop 10.1.8.10/24 LNMP

准备 LNMP 环境

准备 Nginx

# 安装
[root@ecshop ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@ecshop ~]# yum install -y nginx
[root@ecshop ~]# systemctl enable nginx.service –now
[root@ecshop ~]# echo "Nginx Test Page" > /usr/share/nginx/html/index.html

准备 Mariadb

[root@ecshop ~]# yum install -y mariadb-server
[root@ecshop ~]# systemctl enable mariadb –now

# 安全初始化
# 初始化
[root@wordpress ~ 15:05:07]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you'
ve just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): # 【初次】 直接回车(默认无密码)
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y # 输入 y → 设置 root 密码
New password: # 你要设置的密码,如huawei
Re-enter new password: # 再次输入密码
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y # 删除匿名用户(安全)
… Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n # 禁止远程登录root? (项目常用选 n; 安全服务器选y
… skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y # 删除 test 测试库
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y #刷新权限
… Success!

Cleaning up…

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

准备 PHP

[root@ecshop ~]# yum install -y php php-fpm

# 修改 php-fpm 运行用户身份
[root@ecshop ~]# vim /etc/php-fpm.d/www.conf
# 更改以下两条记录
# user = apache
user = nginx

# group = apache
group = nginx
[root@ecshop ~]# systemctl enable php-fpm.service –now

# 配置虚拟主机
[root@ecshop ~]# vim /etc/nginx/conf.d/vhost-shop.laogao.cloud.conf
server {
listen 80;
listen [::]:80;
server_name shop.laogao.cloud;
root /usr/share/nginx/html;

# 设置默认主页
index index.php;

# 设置php页面处理方式
location ~ \\.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
[root@ecshop ~]# systemctl restart nginx

# 准备测试页面
[root@ecshop ~]# echo "<?php echo 'PHP Test Page'.\\"\\n\\"; ?>" > /usr/share/nginx/html/test.php

客户端测试

在这里插入图片描述

准备数据库

[root@ecshop ~]# mysql -u root -phuawei
MariaDB [(none)]> CREATE DATABASE ecshop;
MariaDB [(none)]> CREATE USER ecshop@localhost IDENTIFIED BY 'huawei';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON ecshop.* TO ecshop@localhost;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

准备 ecshop 站点

准备 ecshop 站点数据文件,这里使用 ECShop_V4.1.20 版本。

# 上传到 root 用户家目录
[root@ecshop ~]# unzip ECShop_V4.1.20_UTF8.zip
[root@ecshop ~]# mv /usr/share/nginx/html/ /usr/share/nginx/html.ori
[root@ecshop ~]# cp -a ECShop_V4.1.20_UTF8_release20250416/source/ecshop /usr/share/nginx/html
[root@ecshop ~]# chown nginx:nginx -R /usr/share/nginx/html

# 安装站点需要的各种扩展包
[root@ecshop ~]# yum install -y php-gd php-common php-pear php-mbstring php-mcrypt php-mysqlnd

[root@ecshop ~]# chown nginx:nginx -R /var/lib/php/
[root@ecshop ~]# systemctl restart nginx php-fpm

ECshop 配置

客户端登录 http://shop.mrj.cloud

勾选协议,点击 下一步:配置安装环境

在这里插入图片描述

点击 下一步:配置系统 在这里插入图片描述

页面上方出现的 Warning ,提示使用系统时区不安全,暂时忽略。

输入数据库账户信息后,点击搜,选中搜索到的数据库。

时区选择 亚洲,中国,上海,点击 立即安装。

在这里插入图片描述

激活系统,享受更多服务。不激活也可以使用。关闭网页。 在这里插入图片描述

ECshop 访问

商城首页 http://shop.mrj.cloud 在这里插入图片描述

商城管理后台 http://shop.mrj.cloud/admin 在这里插入图片描述

使用ecshop账户登录 在这里插入图片描述

设置商店的一些基本信息

在这里插入图片描述

ECSHOP管理中心界面如下:

在这里插入图片描述

赞(0)
未经允许不得转载:171主机测评 » 项目实战:LNMP-电商平台-ECshop
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址