Enable Dark Mode!
how-to-set-up-access-to-magento-on-a-local-network-for-odoo-integration.jpg
By: Yassir Irfan

How to Set Up Access to Magento on a Local Network for Odoo Integration

Connectivity problems that can impede API testing and data synchronization may arise when integrating Odoo with Magento, particularly when doing so within a local network. For an integration to be successful, Odoo and Magento must have smooth access set up. You can use this method to set up access from the Odoo server to a Magento installation on a different Ubuntu system connected to the same network. You can connect your Odoo and Magento servers by following these procedures, which will enable API testing and facilitate effective collaboration between the two apps.

Step 1: Find the Local IP Address of the Magento System

First, identify the IP address of the machine running Magento:

1. On the system running Magento, open a terminal and enter:

   ip a

2. Locate the IPv4 Address for the active network connection, which will look like 192.168.1.10

How to Set Up Access to Magento on a Local Network for Odoo Integration-cybrosys

Step 2: Update Magento’s Base URL to Allow IP-Based Access

Magento is typically configured to allow access only from `localhost`, so we need to update the Base URL to accept connections from the IP address.

Update Base URL in Magento Admin Panel

1. Log in to the Magento Admin Panel.

2. Navigate to Stores > Configuration > General > Web.

3. Under Base URLs and Base URLs (Secure), update the URLs to use Magento’s IP address:

   - For example: http://192.168.1.10/ for unsecure and https://192.168.1.10/ for secure URLs.

4. Save changes and flush the Magento cache:

   - Go to System > Cache Management and click Flush Magento Cache.

Update Base URL Directly in the Database (Alternative)

If the Magento Admin Panel isn’t accessible, you can update the Base URL directly in the database.

1. Access the Magento database (using MySQL CLI or a client like phpMyAdmin).

2. Run the following SQL commands:

   UPDATE core_config_data SET value = 'http://192.168.1.10/' WHERE path = 'web/unsecure/base_url';
   UPDATE core_config_data SET value = 'https://192.168.1.10/' WHERE path = 'web/secure/base

3. Clear the cache with:

php bin/magento cache:clean

Step 3: Configure Apache/Nginx to Allow Network Access

Ensure Magento’s web server (Apache or Nginx) is configured to accept connections from other systems on the network.

For Apache

1. Open the Apache configuration file for Magento (e.g,`/etc/apache2/sites-available/magento.conf`).

2. Locate any `Require local` or `Allow from localhost` settings and update them to allow access from the local network range:

   Require ip 192.168.1.0/24

Replace 192.168.1.0/24 with your local network range.

3. Restart Apache:

   sudo systemctl restart apache2

For Nginx

1. Open the Nginx configuration file for Magento (e.g., `/etc/nginx/sites-available/magento`).

2. Update the `allow` directive to include the local network:

   allow 192.168.1.0/24

3. Restart Nginx:

   sudo systemctl restart nginx

Step 4: Allow Firewall Access on the Magento System

If a firewall is enabled, ensure it allows incoming connections on the Magento port.

1. Open the necessary port for Magento on the local network:

sudo ufw allow from 192.168.1.0/24 to any port MAGENTO_PORT   

Replace `MAGENTO_PORT` with the port on which Magento is running (e.g., 8080).

Step 5: Update Hosts File for Seamless Access

On the Odoo system, you can map the Magento server’s IP to a hostname in the hosts file for easy access.

1. Edit the hosts file on the Odoo system:

 sudo nano /etc/hosts 

2. Add an entry to map Magento’s IP address to a hostname:

192.168.1.10 magento.local

3. Save the file. Now, you can access Magento using `http://magento.local:MAGENTO_PORT`.

Step 6: Test Access to Magento from Odoo

Now, verify that the Odoo system can reach the Magento server:

1. On the Odoo system, open a terminal or use an API testing tool.

2. If configured correctly, this should allow you to connect to Magento’s API for testing and integration with Odoo.

Following these steps should set up your Magento server to allow access from the Odoo server, enabling API integration and testing across the local network.

With these setups, you will be ready to use Magento's data in Odoo to its fullest potential, increasing operational effectiveness and opening up more sophisticated testing and integration options. This configuration will provide a strong basis for any Odoo-Magento synergy on an Ubuntu network, whether you are diagnosing connectivity issues or getting ready for an integration project.

To read more about How to Install Magento 2.4.5 in Ubuntu 22.04, refer to our blog How to Install Magento 2.4.5 in Ubuntu 22.04.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message