Magento media url not working - magento

I want to clear that I have already went through this post:
Magento media url - get rid of 403 Forbidden
but I am not still able to get image url from media library. I have tried all these URLs:
localhost/magento/media/customer/pic1.jpg (access forbidden error)
localhost/magento/media/index.html/customer/pic1.jpg (object not found error but image is present)
localhost/magento/media/index.html (working but of no use)

Correct link is localhost/magento/media/customer/pic1.jpg.
Try to set correct files ownership and permissions.
For apache2 server default configuration:
chown -R www-data:www-data /var/www/html/magento
find /var/www/html/magento/media/ -type f -exec chmod 600 {} \;
find /var/www/html/magento/media/ -type d -exec chmod 700 {} \;

I have to make a index.html and .htaccess file same as media folder(as in my referenced link) and to place in media/customer too. it has been fixed now and working with url : localhost/magento/media/customer/pic1.jpg.

Related

wrong script and syntax trouble

goal:
find all documents (texts, pdfs, fotos, etc) on my computer (located in different files) which were changed after a specific date and copy them to a different file,
that's what I typed in a terminal:
find . maxdepth 1 -newermt 2022-02-26 -exec / cp /Schreibtisch/new files after feb 28
as a response I get: missing argument for -exec
cant find the error, pls help
tx,
michael

how to download file VIA wget while target path include Wildcards

here is elegant example how to download file and copy it to
/etc/yum.repo.d folder
example
REPOSITORY_SERVER=master_machine01
wget -nd -r -P /etc/yum.repos.d/ -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/2.6.2.2-1/ambari.repo"
after above command ambari.repo file will copied to /etc/yum.repos.d/
note: the file amabri.rep path is
ls -ltr /var/www/html/ambari/centos7/2.6.2.2-1/ambari.repo
-rw-r--r-- 1 root users 304 Jun 11 2018 /var/www/html/ambari/centos7/2.6.2.2-1/ambari.repo
so this is the simple case
now what about path could be as ( with diff path's )
$REPOSITORY_SERVER/ambari/centos7/2.6.2.3-1/ambari.repo
or
$REPOSITORY_SERVER/ambari/centos7/2.6.2.2-4/ambari.repo
then how to use the cli with Wildcards
we try the following
wget -nd -r -P /etc/yum.repos.d/ -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/*/ambari.repo"
but we get
HTTP request sent, awaiting response... 404 Not Found
2021-11-28 18:40:07 ERROR 404: Not Found.
or even with backslash
wget -nd -r -P /etc/yum.repos.d/ -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/\*/ambari.repo"
BUT WITH THE SAME ERROR
any idea how to resolve this issue?
how to use the cli with Wildcards
It is not possible to perform a glob expansion with HTTP protocol. These are very unrelated technologies.
how to resolve this issue?
Devise and implement a method of getting the available files under certain path from an HTTP server. For example, contact the server administrator and ask him about it. Potentially, if the HTTP server supports serving a directory listing, recursively filter the listing to find all matching paths. Or find and query some other site that contains all the links and filter the obtained answer to extract all links, for example. Etc.

Gitlab CI cache update

On GitlabCI I have caching setup and it is working properly:
cache:
key: gradle
paths:
- .gradle/caches
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
In order to speed up the process of uploading my cache (<20s); and take advantage of this; I delete the "extra" files which have been updated during the build:
after_script:
- rm -rf .gradle/caches/$GRADLE_VERSION/
- rm .gradle/caches/journal-1/file-access.bin
- find .gradle/caches/ -name "*.lock" -type f -delete
I expect CI to skip uploading the cache, since none of the files have been updated anymore. i.e.
Result of
- find .gradle/caches/ -mmin -5 -exec ls -la {} +
is an empty list as well.
But that is not the case and my cache is uploaded on every job.
Am I missing something else? Has anyone else ran into this?

How to enable GZip compression for Gitlab Pages?

When using Gitlab Pages to render my site which is slow in page-ranking. I can't find any solution on how to do following in GitLab (non-enterprise version)
Specify HTTP Cache Headers for various page resources like for an image, so that it can be cached.
Specify/Enable compression for GZip as page-ranking mentions compression disabled in gitlab.io.
It looks like specifying HTTP Cache Headers is still not possible. But at least they have hardcoded "max-age=600" for all the resources here.
You can compress contents of your public folder via .gitlab-ci.yml:
script:
npm install
npm run build
gzip -k -6 -r public
GitLab has support for serving compressed assets if you pre-compress them in the pages CI Job already. See the documentation.
Note that you can and also should use brotli compression as it's optimized for web content and supported by most modern browsers.
There is also a suggested snippet for your .gitlab-ci.yml:
pages:
# Other directives
script:
# Build the public/ directory first
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec brotli -f -k {} \;
I haven't found a way of influencing cache behavior. I am also looking for this.
Enable GZip compression for GitLab Pages
If you add the precompressed .gz versions of the files of your static site, then nginx can serve them instead of the regular ones. Add this line to your .gitlab-ci.yml file:
image: alpine:latest
pages:
stage: deploy
script:
- mkdir .temp
- cp -r * .temp
- mv .temp public
- gzip -k -9 $(find public -type f)
artifacts:
paths:
- public
only:
- master
This command compresses all files found in the public directory with the maximum compression ratio.

Mage::getStoreConfig not returning updated values

Recently we've noticed that Mage::getStoreConfig is not returning updated values in a app/code/local plugin. Everything was working as of last Friday so we assume that something has changed on the server.
We can see the values updating correctly in the database table core_config_data.
We have
recompiled
flushed the Magento Cache
flushed the Cache Storage
reset folder and file ownership and permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
For example, we added an extra character to the store phone number, see that the database value has updated but it doesn't show with the following line
Mage::getStoreConfig('general/store_information/phone')
As a test we duplicated the site and database via Plesk and applied the latest patches to both sites. The duplicated site worked as normal.
I'm intrigued to find out what has happened so any ideas as to what the issue might be would be welcome?

Resources