0

I’m trying to install Magento Open Source on my shared hosting server and want the store to display when I visit my domain. I used the following command:

bin/magento setup:install \
--base-url=https://mydomain.com/ \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento_password \
--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

Unfortunately, I still see the default page of my web hosting service. The public_html directory only contains the default welcome.html file, while all Magento files have been installed in the user directory (parent of public_html).

How can I correctly install Magento so that it displays on my root domain? Also, how can I remove the incorrectly installed files from the user directory?

Thanks for your help

asked Jul 24, 2024 at 9:09

3 Answers 3

0

You need to create a subdirectory under public_html and install the instance in that directory. After that, either point the domain to the subdirectory (https://www.inmotionhosting.com/support/domain-names/how-to-redirect-your-primary-domain-to-a-subdirectory/) or access the Magento instance with the subfolder name. e.g. if the instance is magento247, you can access https://mydomain.com/magento247/

answered Jul 24, 2024 at 10:59
2
  • Thank you for your answer. If I understand correctly, when the customer types the address of the mydomain.com website into the browser, he'll be redirected to the mydomain/subdomain sub-directory where Magento has been installed and the Magento store will be displayed. It's this second url that will appear in the address bar. However, I'd like the Magento store not to be a subdirectory accessed via a url redirect, but directly in the mydomain.com domain. In other words, I would like the address that appears in the client's address bar to be mydomain.com and stay like that. Commented Jul 24, 2024 at 13:34
  • Hi @DonkeytheNobleSteed, yes. You understood correctly. According to your requirement of direct map to the mydomain.com, please follow the steps mentioned here - serverfault.com/a/258996 Commented Jul 25, 2024 at 4:02
0

To correctly install Magento so it displays on your root domain, you'll need to make sure that Magento's files are placed in the public_html directory and the server's document root points to the correct location.

So, you need remove and extract all the files to the "public_html" directory if it's located outside the public_html or in the user directory.

Make sure you are running the command in the correct directory where you want to install the Magento and also specify the folder in the command.

One solution is to change the directory structure and point to the subdomain like mydomain.com/subdomain, but obviously, directly accessing could be feasible.

To remove the original files from the user directory. Use below command:

mv /path/to/user_directory/* /path/to/public_html/
mv /path/to/user_directory/.* /path/to/public_html/ 

After these changes, it's good practice to secure your Magento installation by setting appropriate file permissions and ensuring your env.php file contains the correct database and URL configurations.

answered Jul 29, 2024 at 9:12
0

You need to follow this steps.

  1. From CLI first go to inside public_html of your domain.

  2. Then you need to run the Magento Installation Command as you show on your Question.

  3. Then run the following command from CLI.

     php bin/magento cache:clean
     php bin/magento cache:flush
     php bin/magento indexer:reindex
     php bin/magento setup:upgrade
     php bin/magento setup:static-content:deploy -f
     sudo chmod -R 777 var/ generated/ pub/
    
answered Jul 30, 2024 at 11:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.