Installed Magento 2, tried to go to the Magento Frontend/Admin in Chrome, but only get “This site can’t be reached”
-
23-03-2021 - |
Question
I have been trying to fix this since yesterday without any seeming success or even progress, so I hope someone out there can figure it out and help me.
I have installed Magento 2 using the Ubuntu console, on a pc running windows 10.
I followed this guide (https://websiteforstudents.com/install-magento-2-using-composer-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-1-support/) but at step 8 (the last step) I restarted apache2 and found that the Magento Frontend and Admin weren't accessible for some reason.
I tried entering both
localhost/magento2
andjjsmykker.dk
into the Chrome address bar,magento2
being theServerName
andhttp://jjsmykker.dk/
being theServerAlias
in themagento2.conf
, but all attempts ended in the same error being shown in Chrome (as well as the other browsers I've tried it in).
Below I've included an image of the error Chrome is throwing at me, as well as an image of the magento2.conf
file.
I'm a beginner at both Magento and at using the Ubuntu Console, so I hope you'll bear with me, and that someone here can help me out and get me moving forward after being stuck with this for far too long!
EDIT 1:
I ran these commands as it was suggested in an answer here. It didn't change the error message on Chrome, but I've added this image to show an apache2 warning that according to my research shouldn't impact this situation, but as I'm new at this I've included it just in case I'm wrong.
Solution
Please try to run below commands
sudo a2ensite magento2.conf
sudo systemctl restart apache2
And also add your URL in /etc/hosts
sudo nano /etc/hosts
127.0.0.1 jjsmykker.dk
If on windows remember to change the hosts file manually in windows too! (link)
Update :
To create virtual host follow below given steps one by one
sudo mkdir -p /var/www/magento2
sudo chown -R www-data:www-data /var/www/magento2
sudo nano /var/www/magento2/index.html
<html>
<head>
<title>Welcome to magento2!</title>
</head>
<body>
<h1>Success! The magento2 virtual host is working!</h1>
</body>
</html>
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/magento2.conf
sudo nano /etc/apache2/sites-available/magento2.conf
ServerName magento2
ServerAlias magento2
ServerAdmin webmaster@localhost
DocumentRoot /var/www/magento2
<Directory /var/www/magento2>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
sudo a2ensite magento2.conf
sudo service apache2 reload
Follow this link
Hope this will help you!
OTHER TIPS
G, It can be issue of htaccess or folder permission, try to rename .htaccess file on root and see if it working for you?