20260421 项目实战:ECshop
项目实战ECshopECshop 介绍ECShop 多场景在线商城。用centos7模板克隆一台server节点名称节点IP节点功能ecshop10.1.8.10/24LAMPECshop 部署准备 LNMP 环境准备 Nginx# 安装[rootecshop ~13:47:44]# yum install -y wget[rootecshop ~14:14:56]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo[rootecshop ~14:15:06]# yum install -y nginx[rootecshop ~14:15:40]# systemctl enable nginx.service --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.[rootecshop ~14:15:52]# echo Nginx Test Page /usr/share/nginx/html/index.html# 测试[rootecshop ~14:16:32]# vim /etc/hosts...10.1.8.10 shop.jiang.cloud[rootecshop ~14:16:56]# curl http://shop.jiang.cloud/Nginx Test Page准备 Mariadb[rootecshop ~14:17:18]# yum install -y mariadb-server[rootecshop ~14:18:10]# systemctl enable mariadb.service --now# 安全初始化# 设置root密码为huawei# 删除匿名用户# 删除测试数据库[rootecshop ~14:18:25]# mysql_secure_installationSet root password?[Y/n]Y New password: Re-enter new password: Password updated successfully!Reloading privilege tables..... Success!Remove anonymous users?[Y/n]y... Success!Disallow root login remotely?[Y/n]n... skipping. Removetestdatabase and access to it?[Y/n]y - Droppingtestdatabase...... Success!- Removing privileges ontestdatabase...... Success!Reload privilege tables now?[Y/n]y... Success!All done!If youve completed all of the above steps, your MariaDB installation should now be secure. Thanksforusing MariaDB!准备 PHP[rootecshop ~14:19:06]# yum install -y php php-fpm# 修改 php-fpm 运行用户身份[rootecshop ~14:20:22]# vim /etc/php-fpm.d/www.conf# 更改以下两条记录# user apacheusernginx# group apachegroupnginx[rootecshop ~14:21:27]# systemctl enable php-fpm.service --now# 配置虚拟主机[rootecshop ~14:21:43]# vim /etc/nginx/conf.d/vhost-shop.jiang.confserver{listen80;listen[::]:80;server_name shop.laogao.cloud;root /usr/share/nginx/html;# 设置默认主页index index.php;# 设置php页面处理方式location ~\.php${try_files$uri404;fastcgi_pass127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;include fastcgi_params;}}[rootecshop ~14:24:44]# systemctl restart nginx.service# 准备测试页面[rootecshop ~14:24:58]# echo ?php echo PHP Test Page.\\n\; ? /usr/share/nginx/html/test.php# 客户端测试[rootecshop ~14:26:13]# curl http://shop.jiang.cloud/test.phpPHP Test Page准备数据库[rootecshop ~14:26:38]# mysql -u root -phuaweiMariaDB[(none)]create database ecshop MariaDB[(none)]create user ecshoplocalhost identified byhuawei;Query OK,0rows affected(0.00sec)MariaDB[(none)]grant all privileges on ecshop.* to ecshoplocalhost;Query OK,0rows affected(0.00sec)MariaDB[(none)]flush privileges;Query OK,0rows affected(0.00sec)MariaDB[(none)]exitBye准备 ecshop 站点准备 ecshop 站点数据文件这里使用 ECShop_V4.1.20 版本。[rootecshop ~14:29:43]# unzip ECShop_V4.1.20_UTF8.zip[rootecshop ~14:29:55]# mv /usr/share/nginx/html/ /usr/share/nginx/html.ori[rootecshop ~14:31:12]# cp -a ECShop_V4.1.20_UTF8_release20250416/source/ecshop /usr/share/nginx/html[rootecshop ~14:31:23]# chown nginx:nginx -R /usr/share/nginx/html# 安装站点需要的各种扩展包[rootecshop ~14:31:54]# yum install -y php-gd php-common php-pear php-mbstring php-mcrypt php-mysqlnd[rootecshop ~14:33:16]# chown nginx:nginx -R /var/lib/php/[rootecshop ~14:33:36]# systemctl restart nginx php-fpmECshop 配置客户端登录 http://shop.jiang.cloud