项目实战:ecshop

项目实战:ecshop

准备 LNMP 环境

准备 Nginx
bash 复制代码
# 安装
[root@server ~ 22:17:36]# systemctl enable nginx.service --now
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@server ~ 22:18:44]# echo "nginx test page" > /usr/share/nginx/html/index.html 
[root@server ~ 22:19:27]# vim /etc/hosts
#添加  www.server.cloud

#测试
[root@server ~ 22:19:58]# curl http://www.server.cloud/
nginx test page
准备 Mariadb
bash 复制代码
[root@server ~ 22:22:26]# yum install -y mariadb-server
[root@server ~ 22:22:26]# systemctl enable mariadb.service --now

# 安全初始化
# 设置root密码为123
# 删除匿名用户
# 删除测试数据库
[root@server ~ 22:23:02]# mysql_secure_installation
准备 PHP
bash 复制代码
[root@server ~ 22:25:29]# yum install -y php php-fpm
[root@server ~ 22:25:29]# systemctl enable php-fpm.service --now
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

# 配置虚拟主机
[root@server ~ 22:25:58]# vim /etc/nginx/conf.d/www.server.cloud.conf
server {
    listen       80;
    listen       [::]:80;
    server_name  www.server.cloud;
    root         /usr/share/nginx/html;
    index index.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@server ~ 22:27:10]# systemctl restart nginx.service 

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

# 客户端测试
[root@client ~ 22:31:21]# curl http://www.server.cloud/test.php
PHP Test Page

准备数据库

bash 复制代码
[root@server ~ 22:34:10]# mysql -u root -p
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> create database ecshop;

MariaDB [(none)]> create user ecshop@localhost identified by '123';

MariaDB [(none)]> grant all privileges on ecshop.* to ecshop@localhost;

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit;

准备 ecshop 站点

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

bash 复制代码
# 上传ECShop_V4.1.20_UTF8.zip
[root@server ~ 22:39:35]# rz
[root@server ~ 22:39:35]# ls
anaconda-ks.cfg  ECShop_V4.1.20_UTF8.zip

#解压
[root@server ~ 22:40:22]# unzip ECShop_V4.1.20_UTF8.zip 
[root@server ~ 22:40:22]# ls
anaconda-ks.cfg
ECShop_V4.1.20_UTF8_release20250416
ECShop_V4.1.20_UTF8.zip

#备份html然后复制
[root@server ~ 22:41:18]# mv /usr/share/nginx/html{,.ori}
[root@server ~ 22:41:44]# cp -a ECShop_V4.1.20_UTF8_release20250416/source/ecshop /usr/share/nginx/html

#修改用户用户组
[root@server ~ 22:42:40]# chown nginx:nginx -R /usr/share/nginx/html

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

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

# group = apache
group = nginx

[root@server ~ 22:46:46]# chown nginx:nginx -R /var/lib/php/
[root@server ~ 22:47:14]# systemctl restart nginx.service php-fpm.service 

配置过程

客户端登录http://www.server.cloud






相关推荐
酥暮沐11 小时前
iscsi部署网络存储
linux·网络·存储·iscsi
❀͜͡傀儡师11 小时前
centos 7部署dns服务器
linux·服务器·centos·dns
Dying.Light12 小时前
Linux部署问题
linux·运维·服务器
S190112 小时前
Linux的常用指令
linux·运维·服务器
萤丰信息12 小时前
AI 筑基・生态共荣:智慧园区的价值重构与未来新途
大数据·运维·人工智能·科技·智慧城市·智慧园区
小义_12 小时前
【RH134知识点问答题】第7章 管理基本存储
linux·运维·服务器
运维小欣12 小时前
Agentic AI 与 Agentic Ops 驱动,智能运维迈向新高度
运维·人工智能
梁洪飞13 小时前
内核的schedule和SMP多核处理器启动协议
linux·arm开发·嵌入式硬件·arm
_运维那些事儿13 小时前
VM环境的CI/CD
linux·运维·网络·阿里云·ci/cd·docker·云计算
Y1rong14 小时前
linux之文件IO
linux