Custom Domain Configuration

Why Configure a Custom Domain

  • EasyAdmin8-webman defaults to domain+/admin as the admin URL, which may be common and insecure. To prevent exposure risks, it is recommended to configure a custom domain

Configuration Reminder

  • Configure the custom domain only after the admin system has been successfully installed

  • After configuring a custom domain, the original domain/admin access method will automatically become invalid, and vice versa

How to Configure a Custom Domain

  • Open the .env file, set EASYADMIN.ADMIN_DOMAIN_STATUS to true, and set EASYADMIN.ADMIN_DOMAIN to your desired domain, e.g., admin0x5Uy.xxx.com

  • If the framework has a homepage or other application pages, configure their corresponding domains as well in config/plugin/webman/domain/app.php

  • Then configure reverse proxy for the domain in Nginx [adjust according to your actual project]

    # Configure SSL certificate if needed
    # admin0x5Uy can be customized
    upstream admin0x5Uy {
        server 127.0.0.1:8787; # This port corresponds to APP_PORT in .env
        keepalive 10240;
    }
    
    server {
        listen 80;
        server_name admin0x5Uy.xxx.com; # This domain corresponds to EASYADMIN.ADMIN_DOMAIN in .env
        access_log off;
        root /your/deployment/path/EasyAdmin8-webman/public;
    
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        if (!-f $request_filename){
            rewrite ^/(.*)$ /admin/$1 break;
            proxy_pass http://admin0x5Uy;
        }
      }
      
    }