magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Magento CE 2.4.4 - 404 on static content - developer/default mode #35454

Closed aetonsi closed 2 years ago

aetonsi commented 2 years ago

Preconditions (*)

  1. Magento community edition 2.4.4
  2. linux mint 20.3 una (ubuntu) (but SAME result on Windows11 cmd and Windows11 WSL2)
  3. php 8.1.5
  4. composer 2.3.5
  5. mysql ver 8.0.29-ubuntu0.20.04.3 x86_64
  6. elasticsearch 7.17.3
  7. apache/2.4.41 (ubuntu)

Steps to reproduce (*)

  1. install various packages sudo apt install gzip lsof sed tar p7zip-full unzip zip
  2. install and start elastic search with ./bin/elasticsearch -d -p pid
  3. install php 8.1 and its extensions by adding the repository, then sudo apt install php8.1 php8.1-bcmath php8.1-mysql php8.1-ctype php8.1-curl php8.1-dom php8.1-fileinfo php8.1-gd php8.1-iconv php8.1-intl php8.1-mbstring php8.1-simplexml php8.1-soap php8.1-sockets php8.1-tokenizer php8.1-xmlwriter php8.1-xsl php8.1-zip
  4. edit php.ini with these settings, then restart apache2 service:
        date.timezone = Europe/Rome
    memory_limit = -1
    realpath_cache_size = 10M
    realpath_cache_ttl = 7200
    opcache.enable = 1
    opcache.save_comments = 1
  5. install composer via install script
  6. install mysql-server
  7. in DB: create magento user and database in mysql; grant ALL PRIVILEGES to magento user; create database magento
  8. create magento project:
        cd /var/www/html
        composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
  9. set permissions
        cd /var/www/html/magento2
        find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
        find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
        chown -R :www-data . # Ubuntu
        chmod u+x bin/magento
  10. install magento via
        bin/magento setup:install \
    --base-url=http://localhost/magento2 \
    --db-host=localhost \
    --db-name=magento \
    --db-user=magento \
    --db-password=magento \
    --admin-firstname=ivan \
    --admin-lastname=drago \
    --admin-email=ivandrago@example.com \
    --admin-user=admin \
    --admin-password=admin123 \
    --language=en_US \
    --currency=EUR \
    --timezone=Europe/Rome \
    --use-rewrites=1 \
    --search-engine=elasticsearch7 \
    --elasticsearch-host=localhost \
    --elasticsearch-port=9200 \
    --elasticsearch-index-prefix=magento2 \
    --elasticsearch-timeout=15
  11. open http://localhost/magento2/pub

Expected result (*)

i'd expect to see a fully loaded page

Actual result (*)

image

What i tried

sudo a2enmod rewrite
sudo service apache2 restart
cd /var/www/html/magento2
bin/magento deploy:mode:set developer

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 2 years ago

Hi @aetonsi. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

aetonsi commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @aetonsi. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @aetonsi, here is your Magento Instance: https://1c55e4a80186d1d71b7dd0ee0ae1d352.instances.magento-community.engineering Admin access: https://1c55e4a80186d1d71b7dd0ee0ae1d352.instances.magento-community.engineering/admin_c6d6 Login: 55c78163 Password: ba3ca74a1c39

m2-assistant[bot] commented 2 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 2 years ago

Hello @aetonsi,

Thanks for the report and collaboration!

I would like to suggest you create a virtual host and then try to access the instance using the domain name given in the virtual host.

Thanks

aetonsi commented 2 years ago

Hello @aetonsi,

Thanks for the report and collaboration!

I would like to suggest you create a virtual host and then try to access the instance using the domain name given in the virtual host.

Thanks

Hello, here it is with virtual host in linux mint, i tried with DocumentRoot /var/www/magento2-domain and DocumentRoot /var/www/magento2-domain/pub, the 404 errors persist...

image

engcom-Hotel commented 2 years ago

Hello @aetonsi,

Thanks for your reply!

I can see the vhost entry but I suggest one change to make as below:

DocumentRoot should change from: /var/www/magento2-domain To /var/www/magento2-domain/pub/

Please make the changes restart the apache and let us know if the issue is fixed or not.

Thanks

aetonsi commented 2 years ago

No, same result after i restarted apache:

image

aetonsi commented 2 years ago

Hello, i got it working in the end.

This is what i did:

And it is now working.

Digiraf commented 5 months ago
  • sudo php bin/magento setup:static-content:deploy -f;

it is working because of this command: sudo php bin/magento setup:static-content:deploy -f; but this does not fix the issue. In developer mode the files should be regenerated that is not the case anymore. Am using version 2.4.6-p3. It was working well in earlier versions