cancel
Showing results for 
Search instead for 
Did you mean: 

Installing Magento on Mac does not show sample site on localhost

Installing Magento on Mac does not show sample site on localhost

Hello all 

 

I am struggling with the installation of Magento 2 on a macbook pro (macOS Monterey 12.3.1).

I installed MAMP (works fine - no error in the logs when starting the server); the sql database gets populated by magento installation  (for instance, I can see the baseurl in "core_config_data").

When accessing the baseurl ("http://localhost/magento2/"), nothing is shown in chrome or safari - "the requested url was not found on this server".

I have tried tons of suggested fixes, but none has worked for me.

 

Please let me know what more information you need to get a clearer picture what's happening on my end.

4 REPLIES 4

Re: Installing Magento on Mac does not show sample site on localhost

LE: Playing around with the .htaccess (in magento2 folder) i get the following:

Screenshot 2022-05-06 at 12.53.38.png Diving further into the directories:

Screenshot 2022-05-06 at 12.56.10.png

Let mw know what else shall I try.

Thanks!

Re: Installing Magento on Mac does not show sample site on localhost

It sounds like there might be an issue with your Magento installation or server configuration. Let's go through some steps to troubleshoot and resolve the issue:

  1. Check Web Server Configuration:

    • Make sure your Apache or Nginx server is properly configured to serve Magento files. Check the virtual host configuration, and ensure that the document root points to the Magento installation directory.
  2. Check File Permissions:

    • Ensure that the file and directory permissions are set correctly. Magento requires specific permissions for different directories. You can refer to the official Magento documentation for the recommended file permissions.
  3. Check .htaccess file:

    • Ensure that the .htaccess file in the Magento root directory is present and configured correctly. This file contains important settings for URL rewriting.
  4. Clear Cache:

    • Clear Magento cache and the cache of your web browser. Magento caches configurations, and sometimes changes may not take effect until the cache is cleared.
  5. Check Logs:

    • Check the Magento logs for any error messages. You can find logs in the var/log directory within your Magento installation.
  6. Check Rewrite Module:

    • Make sure that the Apache rewrite module is enabled. You can check this in your Apache configuration.
  7. Update Base URLs:

    • Check the database directly to ensure that the base URLs are set correctly. You can run the following SQL query to verify:
SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
    • Make sure that the web/unsecure/base_url and web/secure/base_url values are set to the correct URL.
  1. Verify Magento Installation:

    • Check if the Magento files are correctly installed in the specified directory. Ensure that there are no missing or corrupted files.
  2. Check PHP Version:

    • Ensure that you are using a supported version of PHP. Magento 2 has specific PHP version requirements.
  3. Check MAMP Configuration:

    • Double-check the MAMP configuration to ensure that it is serving the correct directory and using the correct PHP version.
  4. Browser Console:

    • Open your browser's developer console (usually by pressing F12 or right-clicking and selecting "Inspect," then going to the "Console" tab) to check for any JavaScript errors that might be preventing the page from loading.
  5. Check Apache Error Log:

    • Check the Apache error log for any error messages related to your Magento installation. The Apache error log is usually located in the /var/log/apache2/ directory.

By going through these steps, you should be able to identify and resolve the issue causing Magento not to display the sample site on localhost. If the problem persists, please provide any relevant error messages or log entries for further assistance.

 

Re: Installing Magento on Mac does not show sample site on localhost

Tried all the steps mention but still not working it is looks like admin panel is keeps loading for a while - it only showing the loadings

here is my mac book pro nginx configuration file 


server {

    listen 80;

    server_name dev.local.co.nz;



    root /usr/local/var/www/local/pub;

    index index.php index.html;



    location / {

        try_files $uri $uri/ /index.php?$args;

        autoindex on;

    }



     # Handle requests to media files

    location /media/ {

        try_files $uri $uri/ =404;

    }



    # Handle requests to the pub directory

    location /pub/ {

        try_files $uri $uri/ =404;

    }



location /static/ {

    if (!-f $request_filename) {

         rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;

    }

}



    location ~ \.php$ {

        include fastcgi_params;

        fastcgi_pass localhost:9000;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }

   location ~ /\.ht {

        deny all;

    }

}

please let me know what need to be done 

permission and .ht file are good 

Re: Installing Magento on Mac does not show sample site on localhost

If you're installing Magento on a Mac and not seeing the sample site on localhost, it could be due to a few common issues during setup. Here are some steps to troubleshoot:

1. Check Apache and MySQL (MAMP or XAMPP)

  • Ensure that Apache and MySQL (or MariaDB) are running. You can check if they're active by opening the MAMP or XAMPP control panel and verifying they’re started.
  • If using MAMP, the default URL is usually http://localhost:8888, not http://localhost.

2. Verify Magento Directory

  • Make sure you have installed Magento correctly into the web root directory (typically /Applications/MAMP/htdocs/ for MAMP or /Applications/XAMPP/htdocs/ for XAMPP).
  • If Magento is installed correctly, navigate to the Magento folder via the browser (localhost/[your-Magento-folder]).

3. Permissions Issue

  • Incorrect file permissions can cause issues. Set the correct permissions for Magento’s files:
    sudo chmod -R 777 /path/to/your/magento/folder
    sudo chown -R _www:_www /path/to/your/magento/folder

4. Base URL Configuration

  • During the Magento installation process, ensure the Base URL is correctly configured.
    • Open app/etc/env.php and check the 'web' => ['unsecure' => ['base_url' => '//localhost/'], 'secure' => ['base_url' => '//localhost/']] settings.

5. Enable Sample Data (Optional)

  • If you're expecting the sample site, you need to install Magento sample data. If you missed this step, you can install it after the initial Magento setup:
    php bin/magento sampledata:deploy
    php bin/magento setup:upgrade
    php bin/magento cache:flush

6. Check the Web Server Logs

  • Review Apache or Nginx logs for errors. You can find logs in the following directories:
    • MAMP: /Applications/MAMP/logs/
    • XAMPP: /Applications/XAMPP/xamppfiles/logs/

7. Clear Cache

  • Clear Magento’s cache if the page is still not loading:
    php bin/magento cache:clean
    php bin/magento cache:flush

8. Check for Database Issues

  • If Magento doesn’t connect to the database correctly, it won’t load the sample site. Double-check your app/etc/env.php for correct database connection details.

9. Access the Magento Admin Panel

  • To access the Magento Admin, visit http://localhost/admin, and log in using the credentials you set during installation.

If none of these steps solve the issue, let me know, and we can dig deeper into specific logs or configuration settings! 
answer by Hottu Tech