Hello,
I am trying to get Magento 2.4.3 running. Here is my setup:
On my local computer, I have created a virtual machine in VMWare with Ubuntu 21.10.
I have managed to install all the prerequisites and installed Magento successfully with the following command as magentouser:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3 magento2 [SUCCESS]: Magento installation complete. [SUCCESS]: Magento Admin URI: /admin_1ow6wf Nothing to import.
installation path: /var/www/html/magento2/magento2/
Apache config:
root@devmagento:/home/rapha# cat /etc/apache2/sites-available/000-default.conf
Listen 8080 <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conif # Allow encoded slashes AllowEncodedSlashes NoDecode </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet <VirtualHost *:8080> ProxyPass "/" "http://localhost:9200/" ProxyPassReverse "/" "http://localhost:9200/" </VirtualHost> #<Directory "/var/www/html/magento2/magento2/"> # AllowOverride All #</Directory>
When I enter the server's IP address in my local browser I get the apache default site. I can also go to the Magento path but it only shows me an "Index of" page. If the directory setting in the apache config is uncommented it is not possible to navigate to the magento2 folder from the browser. If I enter the admin URI the page is not found.
What's wrong with my setup?
Let me know if you need any further config files to help me out.
Thank you in advance for your assistance. It is appreciated a lot.
Solved! Go to Solution.
Follow the below steps
1) Refer to the below link:
https://meetanshi.com/blog/install-magento-2-4-2-on-localhost-using-xampp/
2) Now check your .htaccess file or index.php file in the root
3) Pass the below command one by one:
sudo a2enmod rewrite
sudo service apache2 restart
4) Add the below code on /etc/apache2/apache2.conf
<Directory [your path]> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
5) Apply cache using the below commands
rm -rf var/cache/* rm -rf var/generation/*
Also do not forget to clean your varnish cache.
First of all, I want to thank you for your fast replies.
It took me some hours to get Magento up and running. After following your link I was able to open Magento, but it still had no stylesheets loaded and I could not access the admin site or any link on the styleless homepage.
My URL looks like this:
http://192.168.178.44/magento2/magento2/
1) I was wondering why. So I took a look at:
https://support.magento.com/hc/en-us/articles/360032994352
As described with inspecting the site I noticed a wrong stylesheet reference.
I had to make changes to the database:
These are the entries that work for my setup (see https://meetanshi.com/blog/install-magento-2-4-2-on-localhost-using-xampp/ for details)
| 21 | default | 0 | web/secure/base_static_url | http://192.168.178.44/magento2/magento2/pub/static/ | 2021-12-03 17:37:26 | | 22 | default | 0 | web/unsecure/base_static_url | http://192.168.178.44/magento2/magento2/pub/static/ | 2021-12-03 17:37:26 | | 23 | default | 0 | web/secure/base_media_url | http://192.168.178.44/magento2/magento2/pub/media/ | 2021-12-03 17:37:02 | | 24 | default | 0 | web/unsecure/base_media_url | http://192.168.178.44/magento2/magento2/pub/media/
2) The other issue was that not any link on the "homepage" was working. I got 404 not found because of a wrong base URL. I was wondering why it switched the URL to "/magento2/" instead of "/magento2/magento2" after clicking any link.
Luckily I took a look in the database table and found the base-URI there. So I changed it right away as follows:
update core_config_data set value = 'http://192.168.178.44/magento2/magento2/' where value = 'http://192.168.178.44/magento2/';
result in db:
4 | default | 0 | web/unsecure/base_url | http://192.168.178.44/magento2/magento2/ | 2021-12-03 17:49:06 |
Very important after that you need to flush the cache again:
php bin/magento cache:flush
Now I was able to open the admin URI and could follow links on the homepage.
3) But I could not login as admin. It asked for a 2FA setup. I have not set up SMTP and for testing purposes, this is total overkill.
So here's the solution:
For my purpose I used the following command:
bin/magento module:disableMagento_TwoFactorAuth
Now I am able to log in as admin and can move on.
I hope this will help someone facing the same issues.
This is my first time setting up Magento and I am generally not working so much with UNIX systems. This was quite challenging. Not to mention all the issues faced before opening this thread.
That's it for today.
Hello @salesfbits8235
First of all, apply proper permissions, enable apache rewrite_module and refresh apache server.
chmod -R 777 /var/www/html/MAGENTO_2_ROOT_DIRECTORY/ sudo a2enmod rewrite sudo service apache2 restart
For messy frontend, run following command from Magento root:
php bin/magento setup:static-content:deploy
Now clear var directory except .htaccess file and check admin. If you get 404 page, there may be an issue of Symlink. Fot this, Edit apache config file
sudo gedit /etc/apache2/apache2.conf
and replace this code :
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride none Require all granted
with
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted
Note: changed AllowOverride none to AllowOverride All
Now restart apache sudo service apache2 restart and check admin. This should fix admin 404 issue.
Also, make sure, you don't leave /app/etc/ the directory writeable
If my answer is helpful full then please set the accept solution flag and kudos flag so other members can take the same reference.
Thank you for your fast response. I did all the steps unfortunately the behavior is the same.
Follow the below steps
1) Refer to the below link:
https://meetanshi.com/blog/install-magento-2-4-2-on-localhost-using-xampp/
2) Now check your .htaccess file or index.php file in the root
3) Pass the below command one by one:
sudo a2enmod rewrite
sudo service apache2 restart
4) Add the below code on /etc/apache2/apache2.conf
<Directory [your path]> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
5) Apply cache using the below commands
rm -rf var/cache/* rm -rf var/generation/*
Also do not forget to clean your varnish cache.
First of all, I want to thank you for your fast replies.
It took me some hours to get Magento up and running. After following your link I was able to open Magento, but it still had no stylesheets loaded and I could not access the admin site or any link on the styleless homepage.
My URL looks like this:
http://192.168.178.44/magento2/magento2/
1) I was wondering why. So I took a look at:
https://support.magento.com/hc/en-us/articles/360032994352
As described with inspecting the site I noticed a wrong stylesheet reference.
I had to make changes to the database:
These are the entries that work for my setup (see https://meetanshi.com/blog/install-magento-2-4-2-on-localhost-using-xampp/ for details)
| 21 | default | 0 | web/secure/base_static_url | http://192.168.178.44/magento2/magento2/pub/static/ | 2021-12-03 17:37:26 | | 22 | default | 0 | web/unsecure/base_static_url | http://192.168.178.44/magento2/magento2/pub/static/ | 2021-12-03 17:37:26 | | 23 | default | 0 | web/secure/base_media_url | http://192.168.178.44/magento2/magento2/pub/media/ | 2021-12-03 17:37:02 | | 24 | default | 0 | web/unsecure/base_media_url | http://192.168.178.44/magento2/magento2/pub/media/
2) The other issue was that not any link on the "homepage" was working. I got 404 not found because of a wrong base URL. I was wondering why it switched the URL to "/magento2/" instead of "/magento2/magento2" after clicking any link.
Luckily I took a look in the database table and found the base-URI there. So I changed it right away as follows:
update core_config_data set value = 'http://192.168.178.44/magento2/magento2/' where value = 'http://192.168.178.44/magento2/';
result in db:
4 | default | 0 | web/unsecure/base_url | http://192.168.178.44/magento2/magento2/ | 2021-12-03 17:49:06 |
Very important after that you need to flush the cache again:
php bin/magento cache:flush
Now I was able to open the admin URI and could follow links on the homepage.
3) But I could not login as admin. It asked for a 2FA setup. I have not set up SMTP and for testing purposes, this is total overkill.
So here's the solution:
For my purpose I used the following command:
bin/magento module:disableMagento_TwoFactorAuth
Now I am able to log in as admin and can move on.
I hope this will help someone facing the same issues.
This is my first time setting up Magento and I am generally not working so much with UNIX systems. This was quite challenging. Not to mention all the issues faced before opening this thread.
That's it for today.