11.27ECshop+Wordprees

项目实战:ECshop+Wordprees

代理:

正向: 科学上网,我知道目标位置在哪里,但是我自己无法到达。通过花钱,请能到达的人,帮我获取资料,然后再转达给我。

反向: 不关心目标从哪里来,我知道找谁要,他能给我提供。他自己也是找别人要的。

访问 http://www.tongxi66.top/shop/ -> http://shop.tongxi66.top/

访问 http://www.tongxi66.top/blog/ -> http://blog.tongxi66.top/

bash 复制代码
#准备 PHP
[root@ecshop ~]# yum install -y php php-fpm php-mysqlnd
[root@ecshop ~]# systemctl enable php-fpm.service --now

### 配置后端服务器
[root@server conf.d 11:10:31]# pwd
/etc/nginx/conf.d
[root@server conf.d 11:20:17]# vim vhost-shop.tongxi66.top.conf 
server {
    listen       80;
    listen       [::]:80;
    server_name  shop.tongxi66.top;
    root         /usr/share/nginx/shop;
    
    # 设置默认主页
    index index.php;
    autoindex on;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;
}

[root@server conf.d 11:20:24]# cat vhost-blog.tongxi66.top.conf 
server {
    listen       80;
    listen       [::]:80;
    server_name  blog.tongxi66.top;
    root         /usr/share/nginx/blog;
    
    # 设置默认主页
    index index.php;
    autoindex on;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;
}


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


#创建ECshop数据库在放到/usr/share/nginx/shop
MariaDB [(none)]> create database ecshop;
MariaDB [(none)]> create user ecshop@'%' identified by '123';
MariaDB [(none)]> grant all privileges on ecshop.* to ecshop@'%';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

#创建wordpress数据库在放到/usr/share/nginx/blog
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> create user wordpress@'%' identified by '123';
MariaDB [(none)]> grant all privileges on wordpress.* to wordpress@'%';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

[root@server nginx]# cp -a ECShop_V4.1.20_UTF8_release20250416/source/ecshop/ /usr/share/nginx/shop
[root@server nginx]# cp -a wordpress/ /usr/share/nginx/blog
#修改权限
[root@server nginx]# chown nginx:nginx -R /usr/share/nginx/shop/
[root@server nginx]# chown nginx:nginx -R /usr/share/nginx/blog/


[root@server nginx 11:30:54]# ls -d1 /usr/share/nginx/{blog,shop}
/usr/share/nginx/blog
/usr/share/nginx/shop

/usr/share/nginx/blog:来源于wordpress压缩包
/usr/share/nginx/shop:来源于ECshop压缩包
#记得修改owner。

## php 配置
[root@server nginx 11:21:06]# cat /etc/nginx/default.d/php.conf 
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;
}

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

# group = apache
group = nginx


#### client端配置代理服务
[root@proxy ~ 11:18:49]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.1.8.10 shop.tongxi66.top
10.1.8.10 blog.tongxi66.top

[root@client ~ 11:23:03]# cat /etc/nginx/conf.d/proxy.conf
server {
        listen      80 default_server;
        listen      [::]:80 default_server;
        server_name www.tongxi66.top;
        root         /usr/share/nginx/html;
        
        location /shop/ {
            proxy_pass http://shop.tongxi66.top/;
        }
        location /blog/ {
            proxy_pass http://blog.tongxi66.top/;
        }
}
相关推荐
数智顾问27 分钟前
(123页PPT)华为流程管理体系精髓提炼(附下载方式)
运维·华为
网络工程小王1 小时前
【LCEL 链式调用详解】调用篇-2
java·服务器·前端·数据库·人工智能
xhbh6662 小时前
路由端口转发常见应用场景有哪些?有什么?
服务器·ip·端口转发·ip地址·流量转发·建站
宁小法2 小时前
Linux批量删除文件
linux·服务器·批量·删除文件
AC赳赳老秦3 小时前
财务报销自动化:用 OpenClaw 自动识别发票信息、填写报销单、校验报销规则,减少手工操作
运维·网络·eclipse·github·visual studio·deepseek·openclaw
zhangfeng11333 小时前
适合 5人以内小团队的Git 工作流 + Code Review + 自动化部署方案 FastAdmin +linunx服务器宝塔系统 外包项目 —
服务器·git·自动化·php·代码复审
北冥湖畔的燕雀4 小时前
Linux线程编程核心指南
linux·服务器·网络
倔强的石头1064 小时前
【Linux 指南】文件系统系列(一):磁盘底层原理 —— 从物理结构到 CHS与LBA 寻址全解析
linux·运维·服务器
小金的学习笔记4 小时前
小白打造个人博客的神奇秘诀:WordPress 竟如此简单?
服务器
陶然同学5 小时前
【Linux及Shell】VMware&Ubuntu&Xshell安装
linux·运维·xshell8·xftp8