0

I'm running centos 7, mysql and apache vps. Magento web wizard setup was located at

example.com/magento

The installer asked me where I want to install magento, I said example.com

The installation went smoothly without any errors. However when that was done, it got installed in example.com/magento, I mean if you want to go to the homepage you go there.

Furthermore, the homepage doesn't load correctly, it loads as shown in this question

Why am I asking the question instead of following the highest voted answer there?

  1. The other question doesn't address how to fix the URL issue,magento installed itself in the wrong directory.
  2. The other question say to chmod 777 -R magento/. Are you serious? I just want to double check this 777? Isn't that a bit insecure? Back in my days, this was insanity, but I'm old so what do I know
Lynob
  • 805
  • 2
  • 11
  • 19

1 Answers1

1

To update the URL to point to the subfolder, you can either modify the base URLs in the database as I assume you can't access the backend.

You want to update in the core_config_data table both web/unsecure/base_url and web/secure/base_url to point to the base of the magento site.

Then reindex and clear the site cache


With setting permissions, Magento has seemed to have rewritten their permission spec recently.

I have always set 770 on folders and 660 on files as per Magento's (now old) spec https://devdocs.magento.com/guides/v2.3/install-gde/install/legacy-file-system-perms.html

But as per Magento's new Spec, they seem to recommend 775 for folders and 664 for files https://devdocs.magento.com/guides/v2.3/install-gde/prereq/file-sys-perms-over.html

Sam
  • 1,910
  • 7
  • 13
  • The base_url is set correctly in the database in both fields you specified, it's set to example.com, however I can only access it from example.com/magento, I don't want that – Lynob Jun 04 '19 at 21:37
  • I see, 2 ways to solve this,
    1. Move the files on the server up a level so they sit outside the Magento folder
    2. Or modify your Nginx / Apache doc root to point within your Magento folder
    – Sam Jun 04 '19 at 21:40
  • Alright, that solves the url, now if I go to admin url, I get 404 page not found, I deleted the cache. Haven't fixed permissions yet. What's the next step – Lynob Jun 04 '19 at 21:57
  • That sounds like an URL rewrite issue to me, when you moved the files did you make sure to remove the hidden files too? So .htaccess etc. If you did, I would recommend making sure apache rewrites are enabled. If it is I would recommend going over the Magento 2 docs for after the setup process https://devdocs.magento.com/guides/v2.3/install-gde/install/verify.html – Sam Jun 04 '19 at 22:16
  • Issue solved I used this htaccess https://magento.stackexchange.com/a/112109/39008 thanks for your time, you are awesome, I wish you all the best this life has to give. – Lynob Jun 04 '19 at 22:31