How to Install Magento 2 on CentOS 7

Estimated reading time: 4 min

Introduction

Magento is the most popular open-source e-commerce store application. It is written in PHP and uses MySQL/MariaDB database server. It is fully customizable which gives you the ability to customize look, functionality and content of the store. It also comes with thousands of easy to install plugins and layouts. It is very secure and fully SEO ready. In this tutorial, we will install Magento 2.3 using Apache web server, PHP 7.2 and MariaDB 10.3.

Prerequisites

  • Cloud VPS or Dedicated Server with at least 4GB RAM and CentOS 7 installed.
  • You must be logged in via SSH as sudo or root user. This tutorial assumes that you are logged in as a sudo user.
  • A domain name pointed towards your VPS or Dedicated server. In this tutorial, we will use example.com. Replace all occurrences of example.com with your actual domain name.

Step 1: Update the System

Update the system with the latest packages and security patches using these commands.

sudo yum -y update

Step 2: Install Apache Web Server

Run the following command to install Apache web server on your system.

sudo yum -y install httpd

Start Apache web server and enable it to automatically start at boot time by running these commands.

sudo systemctl start httpd
sudo systemctl enable httpd

Allow port 80 to be accessed through the firewall by running.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

Reload firewall so that new setting can take effect.

sudo firewall-cmd --reload

Also, disable SELinux. Otherwise, we will get write permission errors during installations.

sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
sudo setenforce 0

You can now visit example.com from your browser to see the default Apache web page.

Step 3: Install PHP 7.2

Magento 2 is compatible with PHP version 7.1.x and PHP version 7.2.x. In this tutorial, we will install the PHP 7.2.x using IUS community repository.

Set up the IUS repository in your system by running.

curl https://setup.ius.io | sudo bash

Install PHP 7.2 along with all the required PHP modules by running the command.

sudo yum -y install php72u php72u-pdo php72u-opcache php72u-xml php72u-gd php72u-devel php72u-intl php72u-mbstring php72u-json php72u-iconv php72u-mysqlnd php72u-fpm php72u-bcmath php72u-soap unzip

PHP is now installed on your server.

Step 4: Install MariaDB Server

Create the MariaDB 10.3 repository file into the system by running the command.

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Now install the MariaDB server.

sudo yum -y install MariaDB-server MariaDB-client

Start the database server and enable it to automatically start at boot time.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Set a root password and secure the MariaDB instance by running the command.

sudo mysql_secure_installation

Step 5: Create Database for Magento

Log in to your MariaDB instance as root user by running the command.

mysql -u root -p

Run the following queries to create MySQL user and database for Magento. Make sure to change example values with actual ones. Make a note of the credentials as we will require it later during installation.

CREATE DATABASE magento_data;
GRANT ALL ON magento_data.* TO magento@localhost IDENTIFIED BY 'Strong-Password';
FLUSH PRIVILEGES;

Step 6: Install Composer

Composer is a dependency management tool for PHP projects. Download composer install script by running.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Now, install composer using the following command.

sudo php composer-setup.php --install-dir=/usr/bin/ --filename=composer

Step 7: Obtain Free Access Key from Magento Site.

To install Magento using composer, we need the access keys from Magento. Sign up or Log in into Magento Marketplace and navigate to My Profile >> Access Keys in Marketplace tab.

magento-marketplace

Now, click on Create a New Access Key button to generate a new access key.

magento-access-key
Note the Access key for future references as it will also be required later in this tutorial.

Step 8: Create a Magento Project using Composer

Switch to the web root directory of your server and create a Magento project by running the following command.

cd /var/www
sudo composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento

You will be prompted to provide a username password for this. Put the public key of the access key as the username and private key as the password. It will take some time for the Composer to download and install all the required dependencies.

Change the file permissions as required by Magento.

cd /var/www/magento
sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chmod u+x bin/magento

Provide the ownership of the files to the Apache user.

sudo chown -R apache:apache /var/www/magento

Step 9: Create Apache Vhost for Magento

Create a new virtual host file for Magento site by running.

sudo vi /etc/httpd/conf.d/magento.conf

Put the following configuration in the editor. Make sure to change the example.com with your actual domain.

<VirtualHost *:80>
        ServerName example.com
        DocumentRoot /var/www/magento
        ErrorLog /var/log/httpd/magento_error.log
        CustomLog /var/log/httpd/magento_access.log combined

        <Directory /var/www/magento >
                Options FollowSymLinks
                AllowOverride All
        </Directory>
</VirtualHost>

Restart the Apache web server so that the changes we did can take effect.

sudo systemctl restart httpd

Step 10: Install Magento via Web Installer

Open http://example.com in your browser and you should see Magento asking you to accept the terms and conditions. You will be taken to a multi-step installer after you agree to the terms and conditions. Each step is explained below.

  • Readiness Check: This step tests if your server is correctly configured to install Magento. If you had followed the tutorial correctly, you should see all green in the readiness check.
  • Add a Database: Provide the database information which you created on step 5 of the tutorial.
  • Web configuration: Choose the store address and admin panel address. You can choose any random (non-guessable) address as admin panel so that your admin panel is secured from attacks.
  • Customize your Store: Choose default language, time zone and currency for your store.
  • Create Admin Account: Provide administrator information at this step.
  • Install: Click the install button to finally install Magento with your chosen configurations.

Once the installation is done. You can go back to http://example.com to see your storefront.

Conclusion

In this tutorial, we have installed a functional e-commerce store which is ready to be customized as per your need. Log in to the admin panel of your store to play around the settings to discover more. It is recommended to install an SSL on your website, follow this tutorial to learn more.

Was this article helpful?
Dislike 2
Views: 21120

Reader Interactions

Comments

  1. KH says

    Hi
    I try install magento2.4.3 with following this direction,and I successful.Thanks.
    BTW , when I access magento server , I can't reached because of [ERR_TOO_MANY_REDIRECTS] error.But Why???
    Answer me Please 🙁

      • KH says

        Thx reply Bas.
        I use Aache .

        >>Apache/Nginx configuration with the htaccess

        In my case ,this line indicate which locations .htaccess?

        <[/var/www/magento/.htaccess] is my opinion>
        ————————————————————————
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^/pub/
        RewriteCond %{REQUEST_URI} !^/setup/
        RewriteCond %{REQUEST_URI} !^/update/
        RewriteCond %{REQUEST_URI} !^/dev/
        RewriteRule .* /pub/$0 [L]
        DirectoryIndex index.php
        ————————————————————————

        And Here is my all .htaccess
        ————————————————————————
        [root@localhost aaa]# find / -name .htaccess
        /root/.config/composer/.htaccess
        /root/.cache/composer/.htaccess
        /root/.local/share/composer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/.htaccess
        /var/www/magento/vendor/magento/magento2-base/app/.htaccess
        /var/www/magento/vendor/magento/magento2-base/bin/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/generated/.htaccess
        /var/www/magento/vendor/magento/magento2-base/lib/.htaccess
        /var/www/magento/vendor/magento/magento2-base/phpserver/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/errors/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/custom_options/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer_address/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/downloadable/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/import/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/sitemap/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/theme_customization/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/static/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/config/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/performance-toolkit/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/src/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/view/.htaccess
        /var/www/magento/vendor/magento/magento2-base/var/.htaccess
        /var/www/magento/vendor/magento/magento2-base/vendor/.htaccess
        /var/www/magento/vendor/.htaccess
        /var/www/magento/var/.htaccess
        /var/www/magento/var/composer_home/.htaccess
        /var/www/magento/var/composer_home/cache/.htaccess
        /var/www/magento/.htaccess
        /var/www/magento/app/.htaccess
        /var/www/magento/bin/.htaccess
        /var/www/magento/dev/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/generated/.htaccess
        /var/www/magento/lib/.htaccess
        /var/www/magento/phpserver/.htaccess
        /var/www/magento/pub/.htaccess
        /var/www/magento/pub/errors/.htaccess
        /var/www/magento/pub/media/.htaccess
        /var/www/magento/pub/media/custom_options/.htaccess
        /var/www/magento/pub/media/customer/.htaccess
        /var/www/magento/pub/media/customer_address/.htaccess
        /var/www/magento/pub/media/downloadable/.htaccess
        /var/www/magento/pub/media/import/.htaccess
        /var/www/magento/pub/media/sitemap/.htaccess
        /var/www/magento/pub/media/theme_customization/.htaccess
        /var/www/magento/pub/static/.htaccess
        /var/www/magento/setup/.htaccess
        /var/www/magento/setup/config/.htaccess
        /var/www/magento/setup/performance-toolkit/.htaccess
        /var/www/magento/setup/pub/.htaccess
        /var/www/magento/setup/src/.htaccess
        /var/www/magento/setup/view/.htaccess
        ————————————————————————

      • HK says

        Thx reply ,Bas. I use Apache.

        here is conf file.


        ————————————————————————

        # ServerName example.com
        DocumentRoot /var/www/magento
        ErrorLog /var/log/httpd/magento_error.log
        CustomLog /var/log/httpd/magento_access.log combined


        Options FollowSymLinks
        AllowOverride All


        ————————————————————————

        And I unclear this line dedicate.
        >> Apache/Nginx configuration with the htaccess
        which directory's .htaccess?

        here is my all file.

        ————————————————————————
        [root@localhost aaa]# find / -name .htaccess
        /root/.config/composer/.htaccess
        /root/.cache/composer/.htaccess
        /root/.local/share/composer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/.htaccess
        /var/www/magento/vendor/magento/magento2-base/app/.htaccess
        /var/www/magento/vendor/magento/magento2-base/bin/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/generated/.htaccess
        /var/www/magento/vendor/magento/magento2-base/lib/.htaccess
        /var/www/magento/vendor/magento/magento2-base/phpserver/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/errors/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/custom_options/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer_address/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/downloadable/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/import/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/sitemap/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/theme_customization/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/static/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/config/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/performance-toolkit/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/src/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/view/.htaccess
        /var/www/magento/vendor/magento/magento2-base/var/.htaccess
        /var/www/magento/vendor/magento/magento2-base/vendor/.htaccess
        /var/www/magento/vendor/.htaccess
        /var/www/magento/var/.htaccess
        /var/www/magento/var/composer_home/.htaccess
        /var/www/magento/var/composer_home/cache/.htaccess
        /var/www/magento/.htaccess
        /var/www/magento/app/.htaccess
        /var/www/magento/bin/.htaccess
        /var/www/magento/dev/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/generated/.htaccess
        /var/www/magento/lib/.htaccess
        /var/www/magento/phpserver/.htaccess
        /var/www/magento/pub/.htaccess
        /var/www/magento/pub/errors/.htaccess
        /var/www/magento/pub/media/.htaccess
        /var/www/magento/pub/media/custom_options/.htaccess
        /var/www/magento/pub/media/customer/.htaccess
        /var/www/magento/pub/media/customer_address/.htaccess
        /var/www/magento/pub/media/downloadable/.htaccess
        /var/www/magento/pub/media/import/.htaccess
        /var/www/magento/pub/media/sitemap/.htaccess
        /var/www/magento/pub/media/theme_customization/.htaccess
        /var/www/magento/pub/static/.htaccess
        /var/www/magento/setup/.htaccess
        /var/www/magento/setup/config/.htaccess
        /var/www/magento/setup/performance-toolkit/.htaccess
        /var/www/magento/setup/pub/.htaccess
        /var/www/magento/setup/src/.htaccess
        /var/www/magento/setup/view/.htaccess
        ————————————————————————

      • HK says

        Thnx reply , Bas.

        here is /etc/httpd/conf/httpd.conf ↓
        ————————————————————————
        ServerRoot "/etc/httpd"

        Listen 80

        Include conf.modules.d/*.conf

        User apache
        Group apache

        ServerAdmin root@localhost

        AllowOverride none
        Require all denied

        DocumentRoot "/var/www/html"


        AllowOverride None
        Require all granted


        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted


        DirectoryIndex index.html


        Require all denied

        ErrorLog "logs/error_log"

        LogLevel warn


        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common


        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

        CustomLog "logs/access_log" combined


        ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"


        AllowOverride None
        Options None
        Require all granted

        TypesConfig /etc/mime.types

        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz

        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml

        AddDefaultCharset UTF-8


        MIMEMagicFile conf/magic

        EnableSendfile on

        IncludeOptional conf.d/*.conf
        ————————————————————————

        I unclear this line dedicate.
        Apache/Nginx configuration with the htaccess
        which directory's file ???

        here is my all .htaccess↓
        ————————————————————————
        [root@localhost aaa]# find / -name .htaccess
        /root/.config/composer/.htaccess
        /root/.cache/composer/.htaccess
        /root/.local/share/composer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/.htaccess
        /var/www/magento/vendor/magento/magento2-base/app/.htaccess
        /var/www/magento/vendor/magento/magento2-base/bin/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/vendor/magento/magento2-base/generated/.htaccess
        /var/www/magento/vendor/magento/magento2-base/lib/.htaccess
        /var/www/magento/vendor/magento/magento2-base/phpserver/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/errors/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/custom_options/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/customer_address/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/downloadable/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/import/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/sitemap/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/media/theme_customization/.htaccess
        /var/www/magento/vendor/magento/magento2-base/pub/static/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/config/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/performance-toolkit/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/pub/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/src/.htaccess
        /var/www/magento/vendor/magento/magento2-base/setup/view/.htaccess
        /var/www/magento/vendor/magento/magento2-base/var/.htaccess
        /var/www/magento/vendor/magento/magento2-base/vendor/.htaccess
        /var/www/magento/vendor/.htaccess
        /var/www/magento/var/.htaccess
        /var/www/magento/var/composer_home/.htaccess
        /var/www/magento/var/composer_home/cache/.htaccess
        /var/www/magento/.htaccess
        /var/www/magento/app/.htaccess
        /var/www/magento/bin/.htaccess
        /var/www/magento/dev/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
        /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
        /var/www/magento/generated/.htaccess
        /var/www/magento/lib/.htaccess
        /var/www/magento/phpserver/.htaccess
        /var/www/magento/pub/.htaccess
        /var/www/magento/pub/errors/.htaccess
        /var/www/magento/pub/media/.htaccess
        /var/www/magento/pub/media/custom_options/.htaccess
        /var/www/magento/pub/media/customer/.htaccess
        /var/www/magento/pub/media/customer_address/.htaccess
        /var/www/magento/pub/media/downloadable/.htaccess
        /var/www/magento/pub/media/import/.htaccess
        /var/www/magento/pub/media/sitemap/.htaccess
        /var/www/magento/pub/media/theme_customization/.htaccess
        /var/www/magento/pub/static/.htaccess
        /var/www/magento/setup/.htaccess
        /var/www/magento/setup/config/.htaccess
        /var/www/magento/setup/performance-toolkit/.htaccess
        /var/www/magento/setup/pub/.htaccess
        /var/www/magento/setup/src/.htaccess
        /var/www/magento/setup/view/.htaccess
        ————————————————————————

      • HK says

        Thnx reply , Bas.

        here is /etc/httpd/conf/httpd.conf
        ————————————————————————
        ServerRoot "/etc/httpd"

        Listen 80

        Include conf.modules.d/*.conf

        User apache
        Group apache

        ServerAdmin root@localhost

        AllowOverride none
        Require all denied

        DocumentRoot "/var/www/html"


        AllowOverride None
        Require all granted


        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted


        DirectoryIndex index.html


        Require all denied

        ErrorLog "logs/error_log"

        LogLevel warn


        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common


        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

        CustomLog "logs/access_log" combined


        ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"


        AllowOverride None
        Options None
        Require all granted

        TypesConfig /etc/mime.types

        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz

        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml

        AddDefaultCharset UTF-8


        MIMEMagicFile conf/magic

        EnableSendfile on

        IncludeOptional conf.d/*.conf
        ————————————————————————

  2. HK says

    Thx reply ,Bas. I use Apache.

    here is conf file.


    ————————————————————————

    # ServerName example.com
    DocumentRoot /var/www/magento
    ErrorLog /var/log/httpd/magento_error.log
    CustomLog /var/log/httpd/magento_access.log combined


    Options FollowSymLinks
    AllowOverride All


    ————————————————————————

    And I unclear this line dedicate.
    >> Apache/Nginx configuration with the htaccess
    which directory's .htaccess?

    here is my all file.

    ————————————————————————
    [root@localhost aaa]# find / -name .htaccess
    /root/.config/composer/.htaccess
    /root/.cache/composer/.htaccess
    /root/.local/share/composer/.htaccess
    /var/www/magento/vendor/magento/magento2-base/.htaccess
    /var/www/magento/vendor/magento/magento2-base/app/.htaccess
    /var/www/magento/vendor/magento/magento2-base/bin/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
    /var/www/magento/vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
    /var/www/magento/vendor/magento/magento2-base/generated/.htaccess
    /var/www/magento/vendor/magento/magento2-base/lib/.htaccess
    /var/www/magento/vendor/magento/magento2-base/phpserver/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/errors/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/custom_options/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/customer/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/customer_address/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/downloadable/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/import/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/sitemap/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/media/theme_customization/.htaccess
    /var/www/magento/vendor/magento/magento2-base/pub/static/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/config/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/performance-toolkit/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/pub/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/src/.htaccess
    /var/www/magento/vendor/magento/magento2-base/setup/view/.htaccess
    /var/www/magento/vendor/magento/magento2-base/var/.htaccess
    /var/www/magento/vendor/magento/magento2-base/vendor/.htaccess
    /var/www/magento/vendor/.htaccess
    /var/www/magento/var/.htaccess
    /var/www/magento/var/composer_home/.htaccess
    /var/www/magento/var/composer_home/cache/.htaccess
    /var/www/magento/.htaccess
    /var/www/magento/app/.htaccess
    /var/www/magento/bin/.htaccess
    /var/www/magento/dev/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/cache/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/cache/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/.htaccess
    /var/www/magento/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/cache/.htaccess
    /var/www/magento/generated/.htaccess
    /var/www/magento/lib/.htaccess
    /var/www/magento/phpserver/.htaccess
    /var/www/magento/pub/.htaccess
    /var/www/magento/pub/errors/.htaccess
    /var/www/magento/pub/media/.htaccess
    /var/www/magento/pub/media/custom_options/.htaccess
    /var/www/magento/pub/media/customer/.htaccess
    /var/www/magento/pub/media/customer_address/.htaccess
    /var/www/magento/pub/media/downloadable/.htaccess
    /var/www/magento/pub/media/import/.htaccess
    /var/www/magento/pub/media/sitemap/.htaccess
    /var/www/magento/pub/media/theme_customization/.htaccess
    /var/www/magento/pub/static/.htaccess
    /var/www/magento/setup/.htaccess
    /var/www/magento/setup/config/.htaccess
    /var/www/magento/setup/performance-toolkit/.htaccess
    /var/www/magento/setup/pub/.htaccess
    /var/www/magento/setup/src/.htaccess
    /var/www/magento/setup/view/.htaccess
    ————————————————————————

  3. HK says

    Thx reply , Bas.

    here is /etc/httpd/conf/httpd.conf
    ———————————————————————————————
    ServerRoot "/etc/httpd"

    Listen 80

    Include conf.modules.d/*.conf

    User apache
    Group apache

    ServerAdmin root@localhost

    AllowOverride none
    Require all denied

    DocumentRoot "/var/www/html"


    AllowOverride None
    Require all granted


    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted


    DirectoryIndex index.html


    Require all denied

    ErrorLog "logs/error_log"

    LogLevel warn


    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common


    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    CustomLog "logs/access_log" combined


    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"


    AllowOverride None
    Options None
    Require all granted

    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

    AddDefaultCharset UTF-8


    MIMEMagicFile conf/magic

    EnableSendfile on

    IncludeOptional conf.d/*.conf
    ———————————————————————————————

Leave a Reply

Your email address will not be published. Required fields are marked *