You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: server-setup-and-configuration.md
+48-12Lines changed: 48 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,9 @@ Before setting up the server, make sure it meets the following minimum requireme
13
13
- Operating System: Linux, preferably CentOS or Ubuntu.
14
14
- Web Server: Apache or Nginx.
15
15
- Database Server: MySQL or MariaDB.
16
-
- PHP: Version 8.1 or later, with necessary extensions for Magento 2.
16
+
- PHP: Version 8.1 or later, with the necessary extensions for Magento 2.
17
+
- Search Engine: Opensearch ( recommended ) or Elasticsearch
18
+
- composer
17
19
18
20
## Software Stack
19
21
@@ -24,10 +26,19 @@ Choose either Apache or Nginx as your web server. Here's an example of installin
24
26
```bash
25
27
$ sudo apt update
26
28
$ sudo apt install apache2
29
+
$ a2enmod rewrite headers ssl expires brotli
27
30
```
28
31
29
32
After installation, configure Apache by editing the main configuration file located at `/etc/apache2/apache2.conf`.
30
33
34
+
Most of the Apache2 settings are done by Magentos .htaccess file for Apache2. There are some things you should consider.
35
+
36
+
* Make sure to enable deflate and brotli for compression.
37
+
Set up an SSL certificate and redirect to SSL. You can use [let's encrypt](https://letsencrypt.org/de/) or similar services for a free SSL certificate.
38
+
* Make sure, to use a PHP process manager like php-fpm or nginx-unit and set up enough PHP processes for your expected traffic.
39
+
40
+
As nginx can't parse the .htaccess file, you need to set up with a magento configuration. You can use the one [provided by magento](https://github.com/mage-os/mageos-magento2/blob/2.4-develop/nginx.conf.sample).
41
+
31
42
### Database Server
32
43
33
44
Choose either MySQL or MariaDB as your database server. Here's an example of installing and configuring MySQL:
After installation, update the PHP configuration file located at `/etc/php/8.1/apache2/php.ini` and make the necessary
66
+
After installation, update the PHP configuration file located at `/etc/php/8.2/fpm/php.ini` and make the necessary
52
67
changes.
53
68
69
+
To keep up to date with PHP, you should take a look at the repository provided by [Ondřej Surý](https://deb.sury.org/)
70
+
71
+
### composer
72
+
73
+
Fetch the latest composer.phar for https://getcomposer.org/download/
74
+
75
+
### searchengine
76
+
77
+
By default, Magento requires Opensearch or Elasticsearch as a search engine.
78
+
79
+
As Elasticsearch changed its licensing model to a non open-source license with 7.17, it won't be provided by most providers of managed hostings in most version.
80
+
81
+
Instead, you can use the [opensearch](https://opensearch.org/) fork which provides updates under the Apache 2.0 license. You can download it, from the [opensearch homepage](https://opensearch.org/downloads.html)
82
+
54
83
## Server Setup
55
84
56
85
### Installing and Configuring the Web Server
57
86
58
87
1. Install the chosen web server software (Apache or Nginx) as described in the previous section.
59
88
2. Configure the web server to listen on the appropriate IP address and port.
60
-
3. Set up virtual hosts to point to your Magento 2 installation directory.
89
+
3. Set up virtual hosts to point to the pub folder inside your Magento 2 installation directory.
61
90
4. Enable necessary modules and configurations, such as SSL/TLS, if required.
62
91
63
-
### Setting up the Database Server
92
+
### Setting up the database Server
64
93
65
94
1. Install the chosen database server software (MySQL or MariaDB) as described in the previous section.
66
95
2. Secure the database server by running the security script provided by the database software.
67
96
3. Create a new database and database user for Magento 2, and grant the necessary privileges to the user.
97
+
4. It's recommended to increase the InnoDB Buffer pool to make use of your available memory on production servers.
68
98
69
99
### Configuring PHP
70
100
71
101
1. Update the PHP configuration file (`php.ini`) to set the necessary values.
72
102
2. Adjust PHP settings related to memory limits, file uploads, and execution time as needed.
73
103
3. Make sure the required PHP extensions for Magento 2 are enabled.
104
+
4. For production servers, make sure to increase the PHP Opcache for performance.
105
+
74
106
75
107
## Magento 2 Specific Configuration
76
108
@@ -96,13 +128,17 @@ $ sudo a2enmod rewrite
96
128
$ sudo service apache2 restart
97
129
```
98
130
99
-
For Nginx, add the following configuration snippet within the `server` block:
131
+
For Nginx, there is nothing special to do.
132
+
133
+
### Optional components
134
+
135
+
In addition to the requirements, there are some optional components you can install:
136
+
137
+
* You can install varnish as an FPC before magento, for high-performance shops.
138
+
* You can move sessions and magento cache inside a Redis instance. You should use this when you plan to use more than one server.
139
+
* You can use RabbitMQ as an alternative message queue.
140
+
You can move the lock provider from the database to zookeeper.
0 commit comments