With a big catalog of 224+ extensions for your online store
Magento 2 Error: You Don't Have Permission To Access This Server
Your store is running Magento 2 and suddenly got this error You don’t have permission to access Magento on this server. You may get crazy with Linux folder permission in this case. No worries, there is a simple solution for that.
This error indicates that a default document could not be found at the specified URL and that directory listings are not permitted. The permission settings of your server should be changed.
Table of Contents
Magento 2 You Don’t Have Permission To Access/On This Server
You may encounter the problem as follows:
Forbidden
You don't have permission to access /magento on this server.
Solution
Option 1
Grant permissions
sudo chown -R $USER:$USER /var/www/magento
sudo chmod -R 755 /var/www
You can replace correct Magento path /var/www/magento
Option 2
In this approach, there are four steps to resolve this issue:
Step 1: Set the Document Root
-
Navigate to the file C:\xampp\apache\conf\extra\httpd-vhosts.conf.
-
Add the following code to the httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/folder_name/pub"
ServerName yourname.magento.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
- DocumentRoot
"C:/xampp/htdocs/folder_name/pub"
: installed Magento2 folder path location yourname.magento.com
: your desired base URL. (Ex: mageplaza.magento.com)DocumentRoot "C:/xampp/htdocs/folder_name"
: Base URl for Magento2.4.1
Step 2: Add Domain in the Hosts File Run Notepad as an administrator.
-
Open the file C:\Windows\System32\drivers\etc\hosts file in your Notepad.
-
Add the following line at the bottom:
127.0.0.1 yourname.magento.com
- Restart Apache by clicking on the Stop and Start buttons in XAMPP.
Step 3: Set Domain in Env.php File
- Open the file app/etc/env.php.
- Search for downloadable_domains in that file and update the domain URL:
'downloadable_domains' => [
'yourname.magento.com'
],
Step 4: Update Base URL in the Database Table
- Open localhost/phpmyadmin/ in the browser, select the database, and go to SQL Queries.
- Enter the following command:
UPDATE `core_config_data` SET value='http://yourname.magento.com/' WHERE path='web/unsecure/base_url';
Step 5: Clear Cache
Run the command:
php bin/magento c:f
That’s how you can fix the error ‘ You don’t have permission to access/on this server’ with ease. If you still have problems, leave comments below!
Happy coding!
Related Post
Looking for Magento Development Company?
8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.
Get free consultantRecent Tutorials
How to insert Order Attributes to Transactional Emails
How to insert Order Attributes to Transactional Emails
How to add Order Attributes to PDF Order Template
Explore Our Products:
People also searched for
- you don't have permission to access
- you don't have permission to access this server
- you don't have permission to access /userrpm/statusrpm.htm on this server.
- you don't have permission to access on this server
- you don't have permission to access the url on this server.
- you don't have access to this server
- you don t have permission to access on this server
- you don't have access on this server
- you don t have permission to access
- you don't permission to access
- you don't have permission to access the url on this server
- you don't have permission to access /
- forbidden you don't have permission to access / on this server
- you don't have permission to access server
- don't have permission to access
- don't have permission to access on this server
- 2.3.x, 2.4.x
Stay in the know
Get special offers on the latest news from Mageplaza.
Earn $10 in reward now!