Hot answers tagged

28 votes

404 not found error for admin page

For Linux edit the file /etc/apache2/apache2.conf To edit this file use sudo vi /etc/apache2/apache2.conf command <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride ...
  • 21.9k
27 votes

404 not found error for admin page

Please try Below steps Delete var/cache folder Go to database SELECT * FROM core_config_data WHERE path = 'web/seo/use_rewrites' and make it 0 Then enter url in your browser magento_base_url/index....
25 votes
Accepted

How to switch between PHP versions on Ubuntu Nginx

Please use to below command sudo update-alternatives --config php After run above command select the PHP version that you need to use. Press to keep the current choice[*], or type selection ...
22 votes
Accepted

How do I run php custom script on magento2

If you are using nginx configuration that comes with magento you need to put a file inside pub folder to allow access to it from the browser as pub is the document root of the vhost. Magento root dir ...
  • 5,808
19 votes

How do I run php custom script on magento2

For example, to get a product name by the custom script Example 1: Create test.php at the root of Magento var/www/html/magento2/test.php <?php ini_set('display_errors', 1); ini_set('...
  • 21.9k
19 votes

How to Solve 502 Bad Gateway error in Nginx Magento 2?

I installed the magento2 when I am trying to open some pages facing 502 nginx issue, in nginx logs it is showing upstream sent too big header while reading response header from upstream, then solved ...
17 votes
Accepted

Magento 2 how to configure Nginx to allow execute other php files in root folder

If you use the official Nginx config (nginx.conf.sample file in the Magento 2 distribution) then you need change the line 109 from : location ~ (index|get|static|report|404|503)\.php$ { to : ...
15 votes

Magento 2: How to configure Nginx to use multiple websites with sub-folder

I have tried numerous ways to achieve this task. I would like to thank @matias-hidalgo for his contributions, although I did not understand his answer at first read :). Here is the scenario. We have ...
13 votes
Accepted

How to configure nginx for Magento 2?

Magento2 contains NGINX config nginx.conf.sample that can be included in you server section. Let's try with minimal configuration; You need to modify /etc/nginx/sites-available/my-domain.com with the ...
  • 20.4k
11 votes
Accepted

Service Temporarily Unavailable after installing a module

check "maintance.flag" file is present in root folder. If yes delete that file and refresh again. refer this Link
11 votes

Magento 2: Failed to set ini option “session.cookie_samesite” to value “Lax” when updating to - 2.3.6-p1

The session.cookie_samesite PHP INI is available starting from PHP 7.3. If you're getting this error, it's because you are not running PHP 7.3 or above and Magento code you run is not compatible/buggy ...
10 votes

Configure Nginx to single MAGENTO instance for running multiple stores (domains)

at http{ } block: map $request_uri $MAGE_RUN_CODE { default en; ~^/fi/ fi; } map $request_uri $MAGE_RUN_TYPE { default store; ~^/fi/ store; } at php${ } block: ...
  • 3,742
10 votes
Accepted

Magento -site not opening after CLI -installation

So this solved this for me, thank you @Steve Johnson. Edited php.ini file: session.save_handler = files ;session.save_path = "/tmp" --> session.save_handler = files session.save_path = "var/www/...
9 votes
Accepted

Install Magento 2 on different mysql port

http://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-install.html --db-host=localhost:3307 Note: You can optionally specify the database server port in its host name like ...
  • 3,742
9 votes
Accepted

How to enable CORs to access Magento rest APIs : Magento2

Nginx Not pass Access-Control-Allow-Origin by using below module it will pass the header in API It can update from Store >> Config >> General >> WEb Change * to any url you want to ...
  • 2,503
8 votes

How to switch between PHP versions on Ubuntu Nginx

For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service. Take a backup ...
7 votes
Accepted

Getting “access forbidden by rule” error at magento in nginx server /app/etc/local.xml

Since Why does Magento POST to its own app/etc/local.xml? might not have been clear enough, I'll add this as an answer: Actually these messages are a good thing, Magento would warn you in the admin ...
7 votes
Accepted

Magento 2.1 Varnish Cache not Purge

Finally I fixed myself the issue. env.php 'http_cache_hosts' => array ( 0 => array ( 'host' => '127.0.0.1', 'port' => '80', ), ), default.vcl if (req.method == "PURGE") { ...
7 votes

How to Solve 502 Bad Gateway error in Nginx Magento 2?

Are you using NGINX? It seems there is misconfiguration with your server. Try to add: http { .... your config ... fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; } Restart NGINX and after, ...
7 votes

Upstream sent too big header while reading response header from upstream

In my case fresh magento 2.4.1 (nginx on ubuntu) solution (by David Lambauer) worked: In terminal: cd /etc/nginx/sites-available/ ls Open your nginx config file: code magento24.local.config Find &...
7 votes
Accepted

How to set page cache expires to 7 days?

At present I see the expires is set to -1 The Expires header you see is client-side. Browsers should not cache things like product pages, etc. which is why the default Magento VCL sets it to -1 in ...
6 votes
Accepted

Web Server (Apache) Rewrites on NGINX

To answer your questions: 1. What exactly do Web Server Rewrites do? I believe they just remove the index.php from the url? How important are they? Correct, the remove the index.php for the URL to ...
  • 37.4k
6 votes

404 not found error for admin page

Why nobody talk about ? bin/magento info:adminuri This will display your adminuri. More info can be found here.
6 votes

How to run Magento 2 from a subdirectory

If you are trying to create a store only then you need to copy index.php and .htaccess from main website and then change path of require __DIR__ . '/app/bootstrap.php'; To require '../app/...
6 votes
Accepted

How do I install Magento 2 on Mac OSX with Laravel Valet?

I have recently installed Magento 2 on Valet+ on my Mac. Here are the steps I have taken to successfully install it: Install Homebrew if you don't have it on your Mac already Install PHP 7 brew ...
  • 2,325
5 votes
Accepted

Unable to install any extension using magento connect manager No Answer?

Try this may be its use full to you. It solved my problem. Go to downloader/lib/Mage/Archive/Helper/File/Gz.php in your Magento directory and replace $this->_fileHandler = @gzopen($this->...
5 votes
Accepted

Magento 1.9.1 Upgrade Causing Cookie to be reset

So after a long and hard look at what might be going wrong my colleague found the problem. There was code added to detect HTTP_X_FORWARDED_PROTO in the magento root index.php which is as following if(...
5 votes

How do I run php custom script on magento2

If you want to allow more than one php script to be executable like I need (import.php for ERP import product, stock.php for update the inventory with my ERP etc...) : create a new directory scripts ...
  • 691
5 votes

Magento -site not opening after CLI -installation

Thank you so much this also helped me fix my problem... I had used the free Softaculous Installer via my cPanel to install Magento v2.2.6 It said the installation was successful but when trying to ...
5 votes

How to run Magento 2 from a subdirectory

Thanks to everyone who answered, I kept throwing your suggestions and other changes at the system and eventually arrived at a configuration that worked. I'm not in love with this solution, and I ...
  • 221

Only top scored, non community-wiki answers of a minimum length are eligible