cancel
Showing results for 
Search instead for 
Did you mean: 

Index.php resulting in ERR_CONNECTION_REFUSED

Index.php resulting in ERR_CONNECTION_REFUSED

Hi. I have recently completed a M2OS install. I'm able to serve up a dummy index.php from the /pub folder. But when I run the OOTB index.php I get a ERR_CONNECTION_REFUSED. Nothing useful in the logs even after turning on debug level logging. I would appreciate any ideas or feedback. Thanks!

 

Addendum: M2OS v 2.4.7. PHP 8.3.9. Running locally on Mac (Intel chips) with Homebrew Apache. bin/magento is working. I was able to complete all of the installation steps. The log is printing but no errors/exceptions. I have previously installed Docker Magento and used it successfully. Now trying to install the non-Dockerized Magento to prepare for a fresh install on a new host (moving away from Nexcess due to the cost).

2 REPLIES 2

Re: Index.php resulting in ERR_CONNECTION_REFUSED

Hello @plambateks60af 

 

  • Ensure DocumentRoot points to the correct Magento root directory (usually public_html or pub).
  • Verify DirectoryIndex includes index.php.
  • Check for any errors in your Apache configuration file (usually httpd.conf or apache2.conf).
  • Restart Apache after making changes.
  • Check the PHP version installed and ensure it matches Magento requirements.
  • Verify that required PHP extensions are enabled.
  • Check PHP error logs for any clues.
  • Verify file and directory permissions (usually 755 for directories and 644 for files).
  • Check for any missing or corrupted files.
  • Re-run the Magento installation process if necessary.

 

Was my answer helpful? You can accept it as a solution.
175+ professional extensions
Need a developer?Hire Magento Developer

Re: Index.php resulting in ERR_CONNECTION_REFUSED

Hello @plambateks60af,

 

you've set up everything correctly, but you're encountering an issue with Magento's front end serving. The ERR_CONNECTION_REFUSED error typically indicates a problem with the server configuration or network settings. Here are some steps you can take to troubleshoot the issue:

 

  1. Check Apache Configuration:
  • Ensure that the Apache virtual host configuration is set up correctly for your Magento site. Here’s a basic example of what it should look like:
<VirtualHost *:80>
    DocumentRoot "/path/to/magento2/pub"
    ServerName magento.local

    <Directory "/path/to/magento2/pub">
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog "${APACHE_LOG_DIR}/magento_error.log"
    CustomLog "${APACHE_LOG_DIR}/magento_access.log" combined
</VirtualHost>

Make sure that the ServerName matches the URL you're using to access the site.

 

If using SSL, ensure your Apache configuration also has the appropriate SSLEngine and certificate settings.

 

Check Localhost Port:

  • Ensure that Apache is running on the expected port (usually 80 for HTTP or 443 for HTTPS).
  • Use lsof -i :80 (or :443 for HTTPS) to see if Apache is correctly bound to the port.
  1. Verify PHP Compatibility:
  • Double-check that PHP 8.3.9 is fully compatible with Magento 2.4.7. While Magento 2.4.7 supports PHP 8.1 and 8.2, there may be untested or incompatible functions with PHP 8.3.
  • Consider downgrading to PHP 8.1 or 8.2 to see if the issue persists.
  1. Magento File and Folder Permissions:
  • Ensure that the file permissions are correctly set:
sudo chown -R :www-data .

sudo find . -type f -exec chmod 644 {} \;

sudo find . -type d -exec chmod 755 {} \;

 

  1. Check Firewall and Security Settings:
  • Ensure there are no firewall rules on your Mac that might be blocking the connection.
  • You can temporarily disable the firewall to see if that resolves the issue.
  1. Browser Cache and DNS:
  • Clear your browser cache or try accessing the site in an incognito/private window.
  • If using a custom domain (like magento.local), ensure that it’s correctly mapped in your /etc/hosts file.

If the issue will be resolved, Click Kudos & Accept as a Solution.