group | subgroup | title | menu_title | menu_order | functional_areas | |||
---|---|---|---|---|---|---|---|---|
installation-guide |
Prerequisites |
Apache |
Apache |
1 |
|
Magento requires Apache 2.2.x or 2.4.x.
If you're new to all this and need some help getting started, we suggest the following:
- Is the Magento software installed already?
- What is the software that the Magento server needs to run?
- What operating system is my server running?
- How do I log in to my Magento server using a terminal, command prompt, or SSH?
This topic discusses how to enable Apache 2.2 rewrites and specify a setting for the distributed configuration file, .htaccess
.
Magento uses server rewrites and .htaccess
to provide directory-level instructions for Apache. The following instructions are included in all of the other sections in this topic as well.
{% collapsible Click to show Apache 2.4 instructions %} {% include install/allowoverrides24.md %} {% endcollapsible %}
{% collapsible Click to show Apache 2.2 instructions %} {% include install/allowoverrides22.md %} {% endcollapsible %}
{: .bs-callout .bs-callout-info } Failure to enable these settings typically results in no styles displaying on your storefront or Admin.
To verify the Apache version you're currently running, enter:
apache2 -v
The result displays similar to the following:
Server version: Apache/2.2.22 (Ubuntu)
Server built: Jul 22 2014 14:35:32
- If Apache is not installed, see:
- If Apache 2.2 is installed on Ubuntu 12 and you want to use {% glossarytooltip bf703ab1-ca4b-48f9-b2b7-16a81fd46e02 %}PHP{% endglossarytooltip %} 5.6, see the next section
The following sections discusses how to install or upgrade Apache:
- Install Apache
- Upgrade to Apache 2.4 on Ubuntu 12 to use PHP 5.6 or PHP 7
{% collapsible Click to show/hide content %} To install the default version of Apache (Ubuntu 14, 16—Apache 2.4, Ubuntu 12—Apache 2.2):
-
Install Apache
apt-get -y install apache2
-
Verify the installation.
apache2 -v
The result displays similar to the following:
Server version: Apache/2.4.18 (Ubuntu) Server built: 2016-04-15T18:00:57
-
Enable rewrites and
.htaccess
as discussed in the following sections.
{% include install/allowoverrides24.md %}
{% include install/allowoverrides22.md %}
- Solving 403 (Forbidden) errors
- Continue with the next prerequisite (PHP Ubuntu)
- Determine your installation or upgrade path {% endcollapsible %}
{% collapsible Click to show/hide content %} To use PHP 5.6 on Ubuntu 12, you must upgrade Apache to version 2.4. (By default, Ubuntu 12 comes with Apache 2.2.)
To upgrade to Apache 2.4:
-
Add the
ppa:ondrej
repository, which has Apache 2.4:apt-get -y update apt-add-repository ppa:ondrej/apache2 apt-get -y update
-
Install Apache 2.4:
apt-get install -y apache2
If the `apt-get install` command fails because of unmet dependencies, consult a resource like [http://askubuntu.com](http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa){: target="_blank"}. -
Verify the installation.
apache2 -v
Messages similar to the following should display:
Server version: Apache/2.4.10 (Ubuntu) Server built: Jul 22 2014 22:46:25
-
Continue with the next section.
{% include install/allowoverrides24.md %}
- Solving 403 (Forbidden) errors
- Continue with the next prerequisite (PHP Ubuntu)
- Determine your installation or upgrade path {% endcollapsible %}
{% collapsible Click to install Apache on CentOS 6 or 7 %}
Magento requires Apache use server rewrites. You must also specify the type of directives that can be used in .htaccess
, which Magento uses to specify rewrite rules.
Installing and configuring Apache is basically a three-step process: install the software, enable rewrites, and specify .htaccess
directives.
-
Install Apache 2 if you haven't already done so.
yum -y install httpd
-
Verify the installation:
httpd -v
Messages similar to the following display to confirm the installation was successful:
Server version: Apache/2.2.15 (Unix) Server built: Oct 16 2014 14:48:21
-
Continue with the next section.
{: .bs-callout .bs-callout-info } Even though Apache 2.4 is provided by default with CentOS 7, you configure it like Apache 2.2. See the following section.
{% include install/allowoverrides22.md %}
- Solving 403 (Forbidden) errors
- Continue with the next prerequisite (PHP Ubuntu)
- Determine your installation or upgrade path {% endcollapsible %}
{% collapsible Click to install solve 403 errors %} If you encounter 403 Forbidden errors when trying to access the Magento site, you can update your Apache configuration or your virtual host configuration to enable visitors to the site as discussed in one of the following sections:
To enable website visitors to access your site, use one of the Require directives.
For example:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride <value from Apache site>
Order allow,deny
Require all granted
</Directory>
{: .bs-callout .bs-callout-info }
The preceding values for Order
might not work in all cases. For more information, see the Apache documentation{: target="_blank"}.
To enable website visitors to access your site, use the Allow directive.
For example:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride <value from Apache site>
Order allow,deny
Allow from all
</Directory>
{: .bs-callout .bs-callout-info }
The preceding values for Order
might not work in all cases. For more information, see the Apache documentation{: target="_blank"}.
{% endcollapsible %}