After upgrading from 2.4.1 to 2.4.3 community-edition, I am unable to properly access admin login or the website. All that is displayed is the website 404 error page which is correctly formatted with images and messages that are stored on the database. I am aware of the requirement that everything should be going through/pub folder, this was already set up and working before the upgrade.
There are no errors or relevant messages showing in any of the system / htttpd / nginx logs other than a 404 error indicating that /pub/index.php is not found. However putting echo messages in index.php, it is found and showing the messages.
Trying to access the admin login just gives the website 404 error page, no login panel at all.
website conf file is set to point to the <website>/pub
nginx.conf set as root $MAGE_ROOT/pub;
database core_config_data - web/secure/base_url is set to <website>/pub/
This was all set and working pre upgrade, I understand that version 2.4.2 has a problem with stores setup under subfolders, mine isn't and I don't see why this would stop me from accessing the admin login panel.
Any suggestions for what I may be missing here would be most welcome
Hi @BTaylor351 ,
If your virtual host already pointed to /pub directory then no need to add /pub in core_config_data for web/secure/base_url
You just need to add website url in web/unsecure/base_url and web/secure/base_url like https://test.com
Problem Solved? Accept as solution!
Hope it helps!
Gave that a try Ankit, need those to include /pub/. Taking them out gave me the server 404 page as the url no longer had /pub/ in it.
Then there is issue in your virtual host setup.
Your url should point to pub folder directly.
And in core_config_data web/unsecure/base_url and web/secure/base_url should be always without pub like https://xyz.com/
Don't forgot to add slash at the end of URL.
If you are not able to resolve virtual host related issues then try below steps:
1) copy index.php and .htaccess files from /pub to your magento root folder (into shop folder)
2) Find the below line in index.php (from the shop folder)
require _DIR_ . '/../app/bootstrap.php';
and replace it with
require _DIR_ . '/app/bootstrap.php';
3) Go to magento 2 database which you recently created and find the table core_config_data
In this table you need to insert/update below rows
Path => Value
a) web/secure/base_static_url => https://xyz.com/pub/static/
b) web/unsecure/base_static_url => https://xyz.com/pub/static/
c) web/secure/base_media_url => https://xyz.com/pub/media/
d) web/unsecure/base_media_url => https://xyz.com/pub/media/
Hope it helps!
Ok, I will look back through the documentation and see where I've gone wrong. It does still puzzle me that I can some areas but not others like getting the 404 error page. I wouldn't think I should get that if my virtual setup is wrong.
I am still no further forward with this, I am obviously not getting the right combination of settings for my virtual host/nginx/database etc. I also tried the second option you mentioned Ankit of copying the index/htaccess files and changing the web/secure/base….. settings. This allowed me access to login to admin but without any of the page styling which presumably confirms I have something pointing to the wrong place.
The following is a snapshot of various conf files and such :-
set $MAGE_ROOT /var/www/vhosts/<website_name>/httpdocs/kcmag2/pub;
'directories' => [
'document_root_is_pub' => true
Results from this give the following when accessing either admin or website
Have managed to get back access to my admin and site by rerunning the following
php bin/magento cache:clean
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/code/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
Using option 2 of Ankit's suggestions, everything is up and running again. It does mean that the site is not running through the more secure path of /pub/. Still need to sort this out.