Skip to content

Commit 79248f2

Browse files
authored
Update server-setup-and-configuration.md
extended the server setup text
1 parent f454aba commit 79248f2

File tree

1 file changed

+48
-12
lines changed

1 file changed

+48
-12
lines changed

server-setup-and-configuration.md

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Before setting up the server, make sure it meets the following minimum requireme
1313
- Operating System: Linux, preferably CentOS or Ubuntu.
1414
- Web Server: Apache or Nginx.
1515
- 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
1719

1820
## Software Stack
1921

@@ -24,10 +26,19 @@ Choose either Apache or Nginx as your web server. Here's an example of installin
2426
```bash
2527
$ sudo apt update
2628
$ sudo apt install apache2
29+
$ a2enmod rewrite headers ssl expires brotli
2730
```
2831

2932
After installation, configure Apache by editing the main configuration file located at `/etc/apache2/apache2.conf`.
3033

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+
3142
### Database Server
3243

3344
Choose either MySQL or MariaDB as your database server. Here's an example of installing and configuring MySQL:
@@ -39,38 +50,59 @@ $ sudo apt install mysql-server
3950

4051
During the installation, you will be prompted to set the root password for MySQL. Make sure to choose a strong password.
4152

53+
Make sure to use MySQL 8.0 or later.
54+
55+
If your operating system, doesn't support MySQL 8.0, install the software repositories provided by MySQL.
56+
4257
### PHP
4358

44-
Magento 2 requires PHP 8.1 or later. Here's an example of installing PHP and necessary extensions:
59+
Magento 2 requires PHP 8.1 or later. Here's an example of installing PHP and the necessary extensions:
4560

4661
```bash
4762
$ sudo apt update
48-
$ sudo apt install php8.1 php8.1-cli php8.1-fpm php8.1-mysql php8.1-curl php8.1-gd php8.1-intl php8.1-mbstring php8.1-xml php8.1-zip
63+
$ sudo apt install php8.2 php8.2-apcu php8.2-amqp php8.2-bcmath php8.2-bz2 php8.2-cli php8.2-common php8.2-curl php8.2-dba php8.2-fpm php8.2-gd php8.2-igbinary php8.2-imagick php8.2-imap php8.2-intl php8.2-mbstring php8.2-memcached php8.2-msgpack php8.2-mysql php8.2-opcache php8.2-phpdbg php8.2-redis php8.2-soap php8.2-sqlite3 php8.2-xml php8.2-zip
4964
```
5065

51-
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
5267
changes.
5368

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+
5483
## Server Setup
5584

5685
### Installing and Configuring the Web Server
5786

5887
1. Install the chosen web server software (Apache or Nginx) as described in the previous section.
5988
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.
6190
4. Enable necessary modules and configurations, such as SSL/TLS, if required.
6291

63-
### Setting up the Database Server
92+
### Setting up the database Server
6493

6594
1. Install the chosen database server software (MySQL or MariaDB) as described in the previous section.
6695
2. Secure the database server by running the security script provided by the database software.
6796
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.
6898

6999
### Configuring PHP
70100

71101
1. Update the PHP configuration file (`php.ini`) to set the necessary values.
72102
2. Adjust PHP settings related to memory limits, file uploads, and execution time as needed.
73103
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+
74106

75107
## Magento 2 Specific Configuration
76108

@@ -96,13 +128,17 @@ $ sudo a2enmod rewrite
96128
$ sudo service apache2 restart
97129
```
98130

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.
100141

101-
```nginx
102-
location / {
103-
try_files $uri $uri/ /index.php?$args;
104-
}
105-
```
106142

107143
## Conclusion
108144

0 commit comments

Comments
 (0)