2

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 and jjsmykker.dk into the Chrome address bar, magento2 being the ServerName and http://jjsmykker.dk/ being the ServerAlias in the magento2.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!

Chrome error page

magento2.conf file

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. Suggestion 1

2 Answers 2

4

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!

12
  • I've done as instructed now, without success, unfortunately. I've added an extra image to the bottom of my post do show the commands I ran, since Apache2 does give me a warning when I restart or start it, but I've googled the warning and it shouldn't hinder me in what I'm doing if I understood it correctly.
    – P.G.
    Dec 10, 2019 at 12:39
  • Please try to remove http from server alias and only use this "jjsmykker.dk" Dec 10, 2019 at 12:41
  • No success, it still gives the same error in Chrome and after loading it still changes the address bar to jjsmykker/
    – P.G.
    Dec 10, 2019 at 12:48
  • 1
    Means your virtual host is not setup yet. Please follow link which I have added in my answer Dec 10, 2019 at 13:03
  • 1
    Ohh, okay. It should be up and running according to the guide I followed, but I will use the guide in your link and see if I can get it working properly then :)
    – P.G.
    Dec 10, 2019 at 13:06
0

G, It can be issue of htaccess or folder permission, try to rename .htaccess file on root and see if it working for you?

1
  • I'm not certain I have a .htaccess file currently? If I understand correctly it is supposed to be located in the root, right? If so I don't currently have one.
    – P.G.
    Dec 10, 2019 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.