0

After successfully install magento 2.3.3 in centos 7 with nginx, url getting Unable connect error.

Install nginx

Configure nginx

Install magento 2.3 using following commands,

php bin/magento setup:install --base-url=http://localhost/magento2 --db-host=localhost --db-name="magento2" --db-user="root" --db-password="" --admin-firstname="abc" --admin-lastname="abc" --admin-email=abc@gmail.com --admin-user="magento2" --admin-password="magento2123" --language="en_US" --currency="INR" --timezone="Asia/Kolkata" --use-rewrites="1"

Configure SELinux and Firewalld

/etc/nginx/conf.d/magento.conf

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

server {
  listen 8091;
  server_name 192.168.1.64;
  set $MAGE_ROOT /usr/share/nginx/html/magento2;
  include /usr/share/nginx/html/magento2/nginx.conf.sample;
}

If i try the url : 19.168.1.64:8091 getting error like Unable connect error

Anything else i missed?

  • 502 is cause due to a php issue, check your php version compatibility and also cross check required php extensions for magento 2.3.3 – ASQ Dec 27 '19 at 12:19
  • @ASQ Check with my updated post my php version : 7.1.33 – zus Dec 27 '19 at 12:28
0

correct way installing to localhost is:

  1. add your domain to hosts file: 192.168.1.64 myshop.com
  2. change magento base url as:

    php bin/magento setup:store-config:set --base-url="http://myshop.com/" php bin/magento setup:store-config:set --base-url-secure="https://myshop.com/" php bin/magento cache:flush

  3. add domain name to nginx config: listen 8091; server_name myshop.com;

open your browser with: http://myshop.com/

this is it.

| improve this answer | |
  • I just testing with local host, intstead of "myshop.com" shall i use "localhost/magento2"? – zus Dec 30 '19 at 5:03
  • @ vim /etc/nginx/conf.d/magento.conf justpaste.it/3me3h – zus Dec 30 '19 at 5:13
  • domain name and base url must be the same, you can use your base url as: http://192.168.1.64:8091/ but better option to avoid using localhost in base url and even subfolder. – MagenX Dec 30 '19 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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