Magento 2.3 : Serving site from pub, now images get 404Magento 2.3 favicon and logo upload does not take holdHTTPS everywhere - Magento 2Magento 2.1 CE Installed but front/backend not loading/workingCannot use new installed themeFailure reason: 'Unable to unserialize value.'Magento2 - Run Magento multistore from pub directoryError 500 after magento migrationIn production mode the site does not load404 / 500 after installing Magento 2.3Magento 2.3 product image issueError Database Magento 2.3 migration from localhost to server
Does any Greek word have a geminate consonant after a long vowel?
How can my story take place on Earth without referring to our existing cities and countries?
Can you actually break an FPGA by programming it wrong?
How is this practical and very old scene shot?
How to get a character's limb regrown at 3rd level?
Sharing referee/AE report online to point out a grievous error in refereeing
Donkey as Democratic Party symbolic animal
Graph problems as integer programs
Chords behaving as a melody
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Why does the same classical piece sound like it's in a different key in different recordings?
Procedurally generate regions on island
Why do we use a cylinder as a Gaussian surface for infinitely long charged wire?
Why do I need two parameters in an HTTP parameter pollution attack?
Put my student loan in parents’ second mortgage - help?
Is it bad to describe a character long after their introduction?
Prime parity peregrination
Step into the Octagram
Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?
Golf the smallest circle!
Why won't the ground take my seed?
Do launching rockets produce a sonic boom?
Was it really unprofessional of me to leave without asking for a raise first?
How to answer "write something on the board"?
Magento 2.3 : Serving site from pub, now images get 404
Magento 2.3 favicon and logo upload does not take holdHTTPS everywhere - Magento 2Magento 2.1 CE Installed but front/backend not loading/workingCannot use new installed themeFailure reason: 'Unable to unserialize value.'Magento2 - Run Magento multistore from pub directoryError 500 after magento migrationIn production mode the site does not load404 / 500 after installing Magento 2.3Magento 2.3 product image issueError Database Magento 2.3 migration from localhost to server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
My original installation of v2.3.0 was working fine. All images showed up for categories. I decided (after setting up a lot of categories and images for those categories) to serve the site from pub
.
The only code customization my site has is a modification for a bug that is apparently fixed in v2.3.1. Other than that, i have no third party modules installed or other code customizations.
I followed docs to make site more secure using Ubuntu and Apache2 (not nginx). When i visit a page with images (front-end or admin area), i get a 404 not found for the image. Page loads text and css but console outputs:
GET http://192.168.5.10/pub/media/Shoes/nike.jpg 404 (Not Found)
What i've tried that did not work:
- Looking for errors in
/var/log/apache2/error.log
and/var/log/apache2/error.log
(found nothing other than a record of 404 but no permission errors.) - Checked
magento/var/log/system.log
,magento/var/log/exception.log
andmagento/var/log/debug.log
, no permission errors. Switching modes:
bin/magento deploy:mode:set production
bin/magento cache:flush
bin/magento deploy:mode:set developer
bin/magento cache:flushMade sure had default
.htaccess
inmagento
directory.Made sure
pub/
had default.htaccess
.Doc:
bin/magento setup:static-content:deploy -f
"Flush Cache Storage", "Flush Magento Cache", "Flush Catalog Images Cache", and "Flush Static Files Cache" from admin area > System > Cache Management.
Refresh all cache types from admin area > System > Cache Management.
Re-ran permissions as root
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 . && chmod u+x bin/magento
Ran alternative permissions commands (does same thing as above):
cd /var/www/html/<magento install directory>
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/magentoChecking permissions of example image from magento directory:
magentouser$ ls -al pub/media/Shoes/nike.jpg
-rw-rw-r-- 1 magentouser www-data 77645 Jan 15 17:14 pub/media/Shoes/nike.jpgrm -rf var/cache
bin/magento indexer:reindex
Checked my
/etc/apache2/sites-available/000-default.conf
Listen 8080
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/magento2/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
<Directory "/var/www/html">
AllowOverride all
</Directory>Re-started
systemctl restart apache2
Change DocumentRoot back to
/var/www/html/magento2
, and restartedapache2
.Note: i was in the wrong demo server the first time i tried step 16 again. I had spun up so many test servers trying to re-duplicate the issue in different ways (too many terminals open trying to test different variations without attention to IP). I noticed while deleting all the demo servers from the network that the command was in the wrong one. After switching server 56 back to documentRoot to /var/www/html/magento2, and restarting
apache
on server 56, all images show up again normally. but the URL is still like (example):http://192.168.5.10/pub/media/Shoes/nike.jpg
. I'm still not sure how "pub" got in there or even how i would add "pub" if it was't there and I wanted it, or how to remove it from the url and make the system look in the right place without having to re-upload all my images. This test confirmed again that when not serving frompub
, the site works fine...but images appear to be already served in a strange way (unable to confirm this without a snapshot of the system before following docs to serve from "pub")How do you resolve this?
magento2 magento2.3 server-setup 404
add a comment |
My original installation of v2.3.0 was working fine. All images showed up for categories. I decided (after setting up a lot of categories and images for those categories) to serve the site from pub
.
The only code customization my site has is a modification for a bug that is apparently fixed in v2.3.1. Other than that, i have no third party modules installed or other code customizations.
I followed docs to make site more secure using Ubuntu and Apache2 (not nginx). When i visit a page with images (front-end or admin area), i get a 404 not found for the image. Page loads text and css but console outputs:
GET http://192.168.5.10/pub/media/Shoes/nike.jpg 404 (Not Found)
What i've tried that did not work:
- Looking for errors in
/var/log/apache2/error.log
and/var/log/apache2/error.log
(found nothing other than a record of 404 but no permission errors.) - Checked
magento/var/log/system.log
,magento/var/log/exception.log
andmagento/var/log/debug.log
, no permission errors. Switching modes:
bin/magento deploy:mode:set production
bin/magento cache:flush
bin/magento deploy:mode:set developer
bin/magento cache:flushMade sure had default
.htaccess
inmagento
directory.Made sure
pub/
had default.htaccess
.Doc:
bin/magento setup:static-content:deploy -f
"Flush Cache Storage", "Flush Magento Cache", "Flush Catalog Images Cache", and "Flush Static Files Cache" from admin area > System > Cache Management.
Refresh all cache types from admin area > System > Cache Management.
Re-ran permissions as root
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 . && chmod u+x bin/magento
Ran alternative permissions commands (does same thing as above):
cd /var/www/html/<magento install directory>
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/magentoChecking permissions of example image from magento directory:
magentouser$ ls -al pub/media/Shoes/nike.jpg
-rw-rw-r-- 1 magentouser www-data 77645 Jan 15 17:14 pub/media/Shoes/nike.jpgrm -rf var/cache
bin/magento indexer:reindex
Checked my
/etc/apache2/sites-available/000-default.conf
Listen 8080
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/magento2/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
<Directory "/var/www/html">
AllowOverride all
</Directory>Re-started
systemctl restart apache2
Change DocumentRoot back to
/var/www/html/magento2
, and restartedapache2
.Note: i was in the wrong demo server the first time i tried step 16 again. I had spun up so many test servers trying to re-duplicate the issue in different ways (too many terminals open trying to test different variations without attention to IP). I noticed while deleting all the demo servers from the network that the command was in the wrong one. After switching server 56 back to documentRoot to /var/www/html/magento2, and restarting
apache
on server 56, all images show up again normally. but the URL is still like (example):http://192.168.5.10/pub/media/Shoes/nike.jpg
. I'm still not sure how "pub" got in there or even how i would add "pub" if it was't there and I wanted it, or how to remove it from the url and make the system look in the right place without having to re-upload all my images. This test confirmed again that when not serving frompub
, the site works fine...but images appear to be already served in a strange way (unable to confirm this without a snapshot of the system before following docs to serve from "pub")How do you resolve this?
magento2 magento2.3 server-setup 404
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
1
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54
add a comment |
My original installation of v2.3.0 was working fine. All images showed up for categories. I decided (after setting up a lot of categories and images for those categories) to serve the site from pub
.
The only code customization my site has is a modification for a bug that is apparently fixed in v2.3.1. Other than that, i have no third party modules installed or other code customizations.
I followed docs to make site more secure using Ubuntu and Apache2 (not nginx). When i visit a page with images (front-end or admin area), i get a 404 not found for the image. Page loads text and css but console outputs:
GET http://192.168.5.10/pub/media/Shoes/nike.jpg 404 (Not Found)
What i've tried that did not work:
- Looking for errors in
/var/log/apache2/error.log
and/var/log/apache2/error.log
(found nothing other than a record of 404 but no permission errors.) - Checked
magento/var/log/system.log
,magento/var/log/exception.log
andmagento/var/log/debug.log
, no permission errors. Switching modes:
bin/magento deploy:mode:set production
bin/magento cache:flush
bin/magento deploy:mode:set developer
bin/magento cache:flushMade sure had default
.htaccess
inmagento
directory.Made sure
pub/
had default.htaccess
.Doc:
bin/magento setup:static-content:deploy -f
"Flush Cache Storage", "Flush Magento Cache", "Flush Catalog Images Cache", and "Flush Static Files Cache" from admin area > System > Cache Management.
Refresh all cache types from admin area > System > Cache Management.
Re-ran permissions as root
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 . && chmod u+x bin/magento
Ran alternative permissions commands (does same thing as above):
cd /var/www/html/<magento install directory>
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/magentoChecking permissions of example image from magento directory:
magentouser$ ls -al pub/media/Shoes/nike.jpg
-rw-rw-r-- 1 magentouser www-data 77645 Jan 15 17:14 pub/media/Shoes/nike.jpgrm -rf var/cache
bin/magento indexer:reindex
Checked my
/etc/apache2/sites-available/000-default.conf
Listen 8080
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/magento2/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
<Directory "/var/www/html">
AllowOverride all
</Directory>Re-started
systemctl restart apache2
Change DocumentRoot back to
/var/www/html/magento2
, and restartedapache2
.Note: i was in the wrong demo server the first time i tried step 16 again. I had spun up so many test servers trying to re-duplicate the issue in different ways (too many terminals open trying to test different variations without attention to IP). I noticed while deleting all the demo servers from the network that the command was in the wrong one. After switching server 56 back to documentRoot to /var/www/html/magento2, and restarting
apache
on server 56, all images show up again normally. but the URL is still like (example):http://192.168.5.10/pub/media/Shoes/nike.jpg
. I'm still not sure how "pub" got in there or even how i would add "pub" if it was't there and I wanted it, or how to remove it from the url and make the system look in the right place without having to re-upload all my images. This test confirmed again that when not serving frompub
, the site works fine...but images appear to be already served in a strange way (unable to confirm this without a snapshot of the system before following docs to serve from "pub")How do you resolve this?
magento2 magento2.3 server-setup 404
My original installation of v2.3.0 was working fine. All images showed up for categories. I decided (after setting up a lot of categories and images for those categories) to serve the site from pub
.
The only code customization my site has is a modification for a bug that is apparently fixed in v2.3.1. Other than that, i have no third party modules installed or other code customizations.
I followed docs to make site more secure using Ubuntu and Apache2 (not nginx). When i visit a page with images (front-end or admin area), i get a 404 not found for the image. Page loads text and css but console outputs:
GET http://192.168.5.10/pub/media/Shoes/nike.jpg 404 (Not Found)
What i've tried that did not work:
- Looking for errors in
/var/log/apache2/error.log
and/var/log/apache2/error.log
(found nothing other than a record of 404 but no permission errors.) - Checked
magento/var/log/system.log
,magento/var/log/exception.log
andmagento/var/log/debug.log
, no permission errors. Switching modes:
bin/magento deploy:mode:set production
bin/magento cache:flush
bin/magento deploy:mode:set developer
bin/magento cache:flushMade sure had default
.htaccess
inmagento
directory.Made sure
pub/
had default.htaccess
.Doc:
bin/magento setup:static-content:deploy -f
"Flush Cache Storage", "Flush Magento Cache", "Flush Catalog Images Cache", and "Flush Static Files Cache" from admin area > System > Cache Management.
Refresh all cache types from admin area > System > Cache Management.
Re-ran permissions as root
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 . && chmod u+x bin/magento
Ran alternative permissions commands (does same thing as above):
cd /var/www/html/<magento install directory>
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/magentoChecking permissions of example image from magento directory:
magentouser$ ls -al pub/media/Shoes/nike.jpg
-rw-rw-r-- 1 magentouser www-data 77645 Jan 15 17:14 pub/media/Shoes/nike.jpgrm -rf var/cache
bin/magento indexer:reindex
Checked my
/etc/apache2/sites-available/000-default.conf
Listen 8080
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/magento2/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
<Directory "/var/www/html">
AllowOverride all
</Directory>Re-started
systemctl restart apache2
Change DocumentRoot back to
/var/www/html/magento2
, and restartedapache2
.Note: i was in the wrong demo server the first time i tried step 16 again. I had spun up so many test servers trying to re-duplicate the issue in different ways (too many terminals open trying to test different variations without attention to IP). I noticed while deleting all the demo servers from the network that the command was in the wrong one. After switching server 56 back to documentRoot to /var/www/html/magento2, and restarting
apache
on server 56, all images show up again normally. but the URL is still like (example):http://192.168.5.10/pub/media/Shoes/nike.jpg
. I'm still not sure how "pub" got in there or even how i would add "pub" if it was't there and I wanted it, or how to remove it from the url and make the system look in the right place without having to re-upload all my images. This test confirmed again that when not serving frompub
, the site works fine...but images appear to be already served in a strange way (unable to confirm this without a snapshot of the system before following docs to serve from "pub")How do you resolve this?
magento2 magento2.3 server-setup 404
magento2 magento2.3 server-setup 404
edited Feb 10 at 9:09
learnsomemore
asked Feb 7 at 23:46
learnsomemorelearnsomemore
238 bronze badges
238 bronze badges
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
1
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54
add a comment |
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
1
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
1
1
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54
add a comment |
4 Answers
4
active
oldest
votes
After changing your document root in Apache to point to the pub subdirectory your correct image URL is
http://192.168.5.10/media/Shoes/nike.jpg
The image URLs provided by Magento should have the correct path, if you have set somewhere 'pub' in your image paths you have to remove that
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
|
show 2 more comments
I think you may have not put name of correct directory of magento installation in virtualhosts, you've to mention path to pub directory of your magento installation in DocumentRoot.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path to magento installation/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
<Directory "/var/www/html">
AllowOverride all
</Directory>
</VirtualHost>
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
add a comment |
2 things come to mind based on your description:
You might be missing
.htaccess
in your/pub/media/
folder.Since you made changes to Apache, you might have disabled the
Options
FollowSymLinks
setting (since you mentioned that you increased security).
So you might have to change
Options +FollowSymLinks
to
Options +SymLinksIfOwnerMatch
in .htaccess
in the following locations:
- Your root Magento directory
- /pub/
- /pub/media/
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
add a comment |
You just have to remove the trailing slash "/" from the base url. Login to your MySQL console and select the database, execute
UPDATE core_config_data SET value='http://dev.abc.com' WHERE path='web/unsecure/base_url';
At the time of installation Magento by default puts a forward slash at the end of the base url when you change your DocumentRoot to pub, it needs to be updated i.e. remove that trailing slash.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f260914%2fmagento-2-3-serving-site-from-pub-now-images-get-404%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
After changing your document root in Apache to point to the pub subdirectory your correct image URL is
http://192.168.5.10/media/Shoes/nike.jpg
The image URLs provided by Magento should have the correct path, if you have set somewhere 'pub' in your image paths you have to remove that
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
|
show 2 more comments
After changing your document root in Apache to point to the pub subdirectory your correct image URL is
http://192.168.5.10/media/Shoes/nike.jpg
The image URLs provided by Magento should have the correct path, if you have set somewhere 'pub' in your image paths you have to remove that
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
|
show 2 more comments
After changing your document root in Apache to point to the pub subdirectory your correct image URL is
http://192.168.5.10/media/Shoes/nike.jpg
The image URLs provided by Magento should have the correct path, if you have set somewhere 'pub' in your image paths you have to remove that
After changing your document root in Apache to point to the pub subdirectory your correct image URL is
http://192.168.5.10/media/Shoes/nike.jpg
The image URLs provided by Magento should have the correct path, if you have set somewhere 'pub' in your image paths you have to remove that
answered Feb 8 at 8:15
HelgeBHelgeB
3,6682 gold badges4 silver badges23 bronze badges
3,6682 gold badges4 silver badges23 bronze badges
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
|
show 2 more comments
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
I never set images to "pub" anywhere. I uploaded them via the admin GUI while working on categories. I followed the directions exactly from the docs for serving from root. Before serving from pub. images were working. after following docs, images not working.
– learnsomemore
Feb 8 at 12:13
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
ok, can you please provide more information where this image come from? If it is referenced in a cms block, please paste the code in your question. By default magento uploads category images to 'media/catalog/category' directory, images from CMS upload are in 'media/wysiwyg'. Do you get product images with the correct path?
– HelgeB
Feb 8 at 12:32
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
Images where uploaded before serving from pub. To upload image (in this case, to a category) I went to the category, clicked content, clicked upload. Note from my original...everything worked normally before serving from pub. All i did was change DocumentRoot to serve from pub. I did not upload anything after making serve from pub so if the issue is with default upload directory, it should have showed a problem before serving from pub shouldn't it? Given i haven't uploaded any new images after modifying document root?
– learnsomemore
Feb 8 at 13:53
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
media/Shoes is not a Magento default directory. The default directory for category images uploaded in the content area of the category in the admin panel is media/catalog/category. Have you uploaded the image nike.jpg as "category image" in the admin panel? do you see the image now in the admin panel or at least a broken image there?
– HelgeB
Feb 8 at 14:05
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
yes, the image is broken in admin area too. "media/Shoes is not a magento default directory". If I create a category in the backend named 'Shoes", and upload a image to the category content area. that image becomes domain/media/<Cagtegory>/<image>.png. or domain/media/Shoes/nike.png
– learnsomemore
Feb 8 at 14:25
|
show 2 more comments
I think you may have not put name of correct directory of magento installation in virtualhosts, you've to mention path to pub directory of your magento installation in DocumentRoot.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path to magento installation/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
<Directory "/var/www/html">
AllowOverride all
</Directory>
</VirtualHost>
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
add a comment |
I think you may have not put name of correct directory of magento installation in virtualhosts, you've to mention path to pub directory of your magento installation in DocumentRoot.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path to magento installation/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
<Directory "/var/www/html">
AllowOverride all
</Directory>
</VirtualHost>
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
add a comment |
I think you may have not put name of correct directory of magento installation in virtualhosts, you've to mention path to pub directory of your magento installation in DocumentRoot.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path to magento installation/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
<Directory "/var/www/html">
AllowOverride all
</Directory>
</VirtualHost>
I think you may have not put name of correct directory of magento installation in virtualhosts, you've to mention path to pub directory of your magento installation in DocumentRoot.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path to magento installation/pub
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
<Directory "/var/www/html">
AllowOverride all
</Directory>
</VirtualHost>
answered Feb 8 at 18:01
Vivek KumarVivek Kumar
2,7632 gold badges7 silver badges32 bronze badges
2,7632 gold badges7 silver badges32 bronze badges
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
add a comment |
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
Thanks for suggestion. it wasn't that. I updated question to reflect test
– learnsomemore
Feb 8 at 19:23
add a comment |
2 things come to mind based on your description:
You might be missing
.htaccess
in your/pub/media/
folder.Since you made changes to Apache, you might have disabled the
Options
FollowSymLinks
setting (since you mentioned that you increased security).
So you might have to change
Options +FollowSymLinks
to
Options +SymLinksIfOwnerMatch
in .htaccess
in the following locations:
- Your root Magento directory
- /pub/
- /pub/media/
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
add a comment |
2 things come to mind based on your description:
You might be missing
.htaccess
in your/pub/media/
folder.Since you made changes to Apache, you might have disabled the
Options
FollowSymLinks
setting (since you mentioned that you increased security).
So you might have to change
Options +FollowSymLinks
to
Options +SymLinksIfOwnerMatch
in .htaccess
in the following locations:
- Your root Magento directory
- /pub/
- /pub/media/
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
add a comment |
2 things come to mind based on your description:
You might be missing
.htaccess
in your/pub/media/
folder.Since you made changes to Apache, you might have disabled the
Options
FollowSymLinks
setting (since you mentioned that you increased security).
So you might have to change
Options +FollowSymLinks
to
Options +SymLinksIfOwnerMatch
in .htaccess
in the following locations:
- Your root Magento directory
- /pub/
- /pub/media/
2 things come to mind based on your description:
You might be missing
.htaccess
in your/pub/media/
folder.Since you made changes to Apache, you might have disabled the
Options
FollowSymLinks
setting (since you mentioned that you increased security).
So you might have to change
Options +FollowSymLinks
to
Options +SymLinksIfOwnerMatch
in .htaccess
in the following locations:
- Your root Magento directory
- /pub/
- /pub/media/
answered Feb 8 at 18:24
LezLez
1,5508 silver badges31 bronze badges
1,5508 silver badges31 bronze badges
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
add a comment |
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
i made the change to the .htaccess in all 3 areas and restarted apache. Getting a lot more errors (403s in addition to 404s) so i changed it back.
– learnsomemore
Feb 8 at 19:32
add a comment |
You just have to remove the trailing slash "/" from the base url. Login to your MySQL console and select the database, execute
UPDATE core_config_data SET value='http://dev.abc.com' WHERE path='web/unsecure/base_url';
At the time of installation Magento by default puts a forward slash at the end of the base url when you change your DocumentRoot to pub, it needs to be updated i.e. remove that trailing slash.
add a comment |
You just have to remove the trailing slash "/" from the base url. Login to your MySQL console and select the database, execute
UPDATE core_config_data SET value='http://dev.abc.com' WHERE path='web/unsecure/base_url';
At the time of installation Magento by default puts a forward slash at the end of the base url when you change your DocumentRoot to pub, it needs to be updated i.e. remove that trailing slash.
add a comment |
You just have to remove the trailing slash "/" from the base url. Login to your MySQL console and select the database, execute
UPDATE core_config_data SET value='http://dev.abc.com' WHERE path='web/unsecure/base_url';
At the time of installation Magento by default puts a forward slash at the end of the base url when you change your DocumentRoot to pub, it needs to be updated i.e. remove that trailing slash.
You just have to remove the trailing slash "/" from the base url. Login to your MySQL console and select the database, execute
UPDATE core_config_data SET value='http://dev.abc.com' WHERE path='web/unsecure/base_url';
At the time of installation Magento by default puts a forward slash at the end of the base url when you change your DocumentRoot to pub, it needs to be updated i.e. remove that trailing slash.
answered Jun 19 at 13:46
AdnanAdnan
3792 silver badges11 bronze badges
3792 silver badges11 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f260914%2fmagento-2-3-serving-site-from-pub-now-images-get-404%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you try to restart your server?
– Edwin Widhiyanto
Feb 8 at 6:48
1
@EdwinWidhiyanto "Have you tried turning it off and back on again" lol. yes
– learnsomemore
Feb 8 at 13:54