0

I'm installing a magento on my local ubuntu vm to play around with it. I have successfully installed it but accessing it with local domain is not working.

I have added xyz.com as local domain in the ngix config as below.

upstream fastcgi_backend {
server unix:/run/php/php8.1-fpm.sock;
}

server {
server_name xyz.com;
listen 80;
set $MAGE_ROOT /var/www/magento;
set $MAGE_MODE developer; # or production

access_log /var/log/nginx/magento-access.log;
error_log /var/log/nginx/magento-error.log;

include /var/www/magento/nginx.conf.sample;
}

And in the magento installation, I hav set the base-url to xyz.com as well.

sudo -u www-data bin/magento setup:install --base-url=http://xyz.com --db-host=localhost --db-name=mydb --db-user=myuser --db-password=mypass --admin-firstname=admin --admin-lastname=admin [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=http://localhost --elasticsearch-port=9200 --elasticsearch-index-prefix=magento2 --elasticsearch-timeout=15 --elasticsearch-enable-auth=0

But when I try to access xyz.com from the browser, instead of my magento website, it goes to the actual xyz.com from the internet.

Did I miss anything to be configured?

1
  • @GeneralGrievance replaced images with texts now. Sep 21 at 1:47

2 Answers 2

1

To point xyz.com to your local machine, you need to add a config to your /etc/hosts file:

127.0.0.1 xyz.com

3
  • I did that but still going to the internet. Sep 20 at 10:19
  • @YeMyatAung You might need to flush your DNS records cache
    – S.Murtadha
    Sep 20 at 11:47
  • @YeMyatAung I noticed that you attempted to set up Magento on your local environment by using docker-magento. Someone has provided a solution in your post, did you check it out? magento.stackexchange.com/questions/368238/…. I highly recommend using that docker configuration as it significantly saves time in development and setting up the environment.
    – Tu Van
    Sep 20 at 12:07
0

I changed the xyz.com to localhost and I can now access it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.