cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure megento with new domain

Re: How to configure megento with new domain

 

How to Set Up a Custom Domain in Magento

1. Point Your Domain to Your Server

  • Go to your domain registrar (like GoDaddy, Namecheap, etc.)

  • Set the A record of your domain to point to your server's IP address

    2. Update Web Server Configuration

    Depending on what web server you use (Apache or Nginx), update the configuration:

    For Apache:

    • Edit your virtual host file (usually in /etc/apache2/sites-available/)

    • Set ServerName to your new domain

    • Example:

      apache
      CopyEdit
      <VirtualHost *:80> ServerName yourdomain.com DocumentRoot /var/www/html/magento/ ... </VirtualHost>

      For Nginx:

      • Update your Nginx config (usually in /etc/nginx/sites-available/)

      • Example:

        nginx
        CopyEdit
        server { listen 80; server_name yourdomain.com; root /var/www/html/magento; ... }

        Restart Apache or Nginx after updating:

         

        bash
        CopyEdit
        sudo systemctl restart apache2 # or for Nginx sudo systemctl restart nginx

         

         

        3. Update Magento Base URLs

        Run the following commands (replace yourdomain.com with your domain):

         

        bash
        CopyEdit
        php bin/magento setup:store-config:set --base-url=http://yourdomain.com/ php bin/magento setup:store-config:set --base-url-secure=https://yourdomain.com/

         

         

        4. Clear Cache & Reindex Magento

         

        bash
        CopyEdit
        php bin/magento cache:flush php bin/magento indexer:reindex
         

        5. Optional: Set Up HTTPS

        If you want to use SSL (HTTPS), install a certificate (like from Let's Encrypt) and configure your server accordingly.

      •  

    •  

    •  

  •