Revive Adserver 域名更换操作指南

laoluo
laoluo
laoluo
管理员
32
文章
0
粉丝
教程评论13阅读模式

更换 Revive Adserver 域名,核心是改配置文件、改数据库、改 Web 服务器、更新 SSL 与 301 重定向、更新调用代码,按下面步骤操作即可。


一、准备工作(必做)

  1. 完整备份
    • 压缩整个 Revive 目录(含 var/ 配置、www/images/ 素材)
    • 导出 MySQL 数据库(如 revive_db
  2. 新域名准备
    • 注册新域名并完成备案
    • 新域名 DNS A 记录指向服务器公网 IP
    • 申请新域名 SSL 证书(推荐 Let’s Encrypt)

二、修改 Revive 核心配置

1. 重命名并编辑 var/ 配置文件

  • 原配置文件:var/olddomain.com.conf.php
  • 复制为新配置:cp var/olddomain.com.conf.php var/newdomain.com.conf.php
  • 编辑新文件:
[webpath]
; 替换为新域名
web=http://newdomain.com/
webSSL=https://newdomain.com/
images=http://newdomain.com/www/images/
imagesSSL=https://newdomain.com/www/images/

[general]
; 系统URL改为新域名
adminURL=https://newdomain.com
  • 删除旧配置文件:rm var/olddomain.com.conf.php

2. 数据库替换域名(关键)

登录 MySQL,执行全局替换(先备份!):

USE revive_db;
-- 替换所有表中的旧域名
UPDATE ox_banners SET html = REPLACE(html, 'olddomain.com', 'newdomain.com');
UPDATE ox_zones SET append = REPLACE(append, 'olddomain.com', 'newdomain.com');
UPDATE ox_config SET value = REPLACE(value, 'olddomain.com', 'newdomain.com');
UPDATE ox_affiliates SET website = REPLACE(website, 'olddomain.com', 'newdomain.com');
  • 检查表:ox_banners, ox_zones, ox_config, ox_affiliates 等含 URL 的表

三、Web 服务器配置(Nginx/Apache)

Nginx 示例

server {
    listen 80;
    server_name newdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name newdomain.com;

    ssl_certificate /path/to/newdomain.crt;
    ssl_certificate_key /path/to/newdomain.key;

    root /path/to/revive;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
  • 重启服务:systemctl restart nginx

Apache 示例(httpd.confvhosts.conf

<VirtualHost *:443>
    ServerName newdomain.com
    DocumentRoot /path/to/revive

    SSLEngine on
    SSLCertificateFile /path/to/newdomain.crt
    SSLCertificateKeyFile /path/to/newdomain.key

    <Directory /path/to/revive>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
  • 重启服务:systemctl restart httpd

四、旧域名 301 重定向(保流量)

在旧域名服务器配置全站重定向:

# Nginx
server {
    listen 80;
    server_name olddomain.com;
    return 301 https://newdomain.com$request_uri;
}
# Apache
Redirect 301 / https://newdomain.com/

五、更新调用代码与验证

  1. 登录新域名后台https://newdomain.com/admin
  2. 检查站点配置:Inventory → Websites,更新网站 URL 为新域名
  3. 重新生成广告调用代码(关键!):
    • Zones → 选中广告位 → Invocation Code
    • 复制新代码替换所有站点旧代码
  4. 测试访问
    • 打开新域名后台,确认无报错
    • 检查广告素材加载正常(www/images/ 路径)
    • 验证统计数据正常上报

六、常见问题

  • 后台仍显示旧域名:清除浏览器缓存,或删除 var/cache/ 目录
  • 广告图片 404:检查 [webpath]images 路径是否为新域名
  • 数据库替换遗漏:用 SELECT * FROM ox_table WHERE column LIKE '%olddomain.com%' 排查

七、切换后维护

  • 保留旧域名 301 重定向至少 3–6 个月
  • 更新搜索引擎、统计平台(如 Google Analytics)域名配置
  • 监控 404 错误,及时修复遗漏链接

 
laoluo
  • 本文由 laoluo 发表于2026年6月15日 17:02:46
  • 转载请务必保留本文链接:https://www.mydata-api.com/tutorials/50.html
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证