You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为OroCommerce安装Let's Encrypt SSL证书并自动续期及修改后台URL

为OroCommerce配置Let's Encrypt SSL证书、自动续期及修改后台管理URL

一、安装Let's Encrypt SSL证书

假设你的OroCommerce部署在Nginx或Apache服务器上,用Certbot工具快速部署证书:

  1. 安装Certbot及对应服务器插件
    • 若用Nginx(Ubuntu/Debian):
      sudo apt update && sudo apt install certbot python3-certbot-nginx
      
    • 若用Apache(Ubuntu/Debian):
      sudo apt update && sudo apt install certbot python3-certbot-apache
      
  2. 获取并配置证书
    运行以下命令,替换your-orocommerce-domain.com为你的实际域名:
    sudo certbot --nginx -d your-orocommerce-domain.com
    # Apache环境替换为 sudo certbot --apache -d your-orocommerce-domain.com
    
    按提示完成操作,建议选择“Redirect HTTP traffic to HTTPS”选项,自动完成HTTP到HTTPS的跳转配置。

二、配置SSL证书自动续期

Certbot默认自带自动续期的定时任务,但可以验证是否正常工作:

  1. 测试续期流程
    sudo certbot renew --dry-run
    
    输出无错误则说明续期机制正常。
  2. 手动添加定时任务(可选)
    如果默认定时任务未生效,可手动添加Cron任务,每天凌晨2点执行续期:
    sudo crontab -e
    
    添加一行:
    0 2 * * * /usr/bin/certbot renew --quiet
    
    保存退出即可。

三、修改OroCommerce后台管理URL

  1. 修改环境配置文件
    找到OroCommerce根目录下的.env文件,编辑ORO_BACKEND_PREFIX参数,替换为你想要的自定义路径,比如:
    ORO_BACKEND_PREFIX=/admin-dashboard
    
    同时确保APP_URL设置为HTTPS地址:
    APP_URL=https://your-orocommerce-domain.com
    
  2. 清除应用缓存
    运行命令清除生产环境缓存:
    sudo php bin/console cache:clear --env=prod
    
  3. 验证Web服务器配置
    确保Nginx/Apache的配置文件中,允许自定义后台路径的PHP请求。以Nginx为例,检查配置文件中是否有类似规则:
    location ~ ^/admin-dashboard(/.*)$ {
        try_files $uri /index.php$is_args$args;
    }
    
    若没有则添加,然后重启Web服务器:
    sudo systemctl restart nginx
    # Apache环境替换为 sudo systemctl restart apache2
    

之后访问https://your-orocommerce-domain.com/admin-dashboard即可进入自定义路径的后台管理页面。

内容的提问来源于stack exchange,提问作者androidebug

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 13:50:27