# Установка веб-серверов Nginx и Apache.

Итоговая архитектура для разработки предполагается такая:

```
                Internet
                    ↓
        ┌─────────────────────┐
        │       Nginx         │  ← порт 8081 (вход)
        └─────────────────────┘
            ↓            ↓
     WordPress      .NET apps (опционально)
     (Apache)           (Kestrel)
            ↓
        MariaDB
        PostgreSQL
```

### 🥇 Роли компонентов

#### 🌐 Nginx (front door)

- SSL (HTTPS)
- маршрутизация
- защита
- статика

---

#### 🟦 Apache (только WordPress)

**<span class="hover:entity-accent entity-underline inline cursor-pointer align-baseline"><span class="whitespace-normal">Apache HTTP Server</span></span>**

- PHP обработка
- WordPress
- .htaccess

### 🚀 ШАГ 1 — установка пакетов

В **<span class="hover:entity-accent entity-underline inline cursor-pointer align-baseline"><span class="whitespace-normal">Ubuntu</span></span>**:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-apt-updatesudo-"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-apt-updatesudo--1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> apt update  
  
<span class="ͼd">sudo</span> apt install <span class="ͼf">-y</span> nginx</div><div class="cm-content q9tKkq_readonly">  
<span class="ͼd">sudo</span> apt install <span class="ͼf">-y</span> apache2</div><div class="cm-content q9tKkq_readonly">  
<span class="ͼd">sudo</span> apt install <span class="ͼf">-y</span> mariadb-server  
<span class="ͼd">sudo</span> apt install <span class="ͼf">-y</span> postgresql  
</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>---

### ⚙️ ШАГ 2 — порты (ВАЖНО)

#### Apache уводим с 80:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fapach"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fapach-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> nano /etc/apache2/ports.conf</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div>Примерное содержимое:

```
Listen 8082

<IfModule ssl_module>
	Listen 443
</IfModule>

<IfModule mod_gnutls.c>
	Listen 443
</IfModule>

```

И в site config:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fapach-2"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fapach-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> nano /etc/apache2/sites-available/000-default.conf</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div>Примерное содержимое с учетом проекта на wordpress:

```
<VirtualHost *:8082>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	Alias /portfolio /mnt/d/Soft/Freelance/Wordpress/portfolio/site
	<Directory /mnt/d/Soft/Freelance/Wordpress/portfolio/site>
		Options Indexes FollowSymLinks Includes ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
		Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
    
</VirtualHost>

```

#### Устанавливаем

<div class="h-full min-h-0 min-w-0" id="bkmrk-sudo-apt-install--y-"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-apt-install--y--1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> apt install <span class="ͼf">-y</span> php php-mysql libapache2-mod-php</div></div></div></div></div></div></div></div></div></div>Эта установка запустит триггеры, один из которых запустит Apache, теперь он будет на правильном порту, если запуска Apache не произойдет, перезапустим его вручную:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-resta"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-systemctl-resta-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl <span class="ͼd">restart</span> apache2</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>---

### 🌐 ШАГ 3 — WordPress (Apache backend)

Документа root:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%2Fvar%2Fwww%2Fhtml"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-%2Fvar%2Fwww%2Fhtml-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">/var/www/html</div></div></div></div></div></div></div></div></div></div><div class="">Но выше в конфиге был определен алиас "portfolio", это папка, которая подмонтирована из windows и в ней установлен wordpress.</div></div></div></div>### ШАГ 4 — включить mod\_rewrite (нужно для WordPress)

<div class="" id="bkmrk-sudo-a2enmod-rewrite"><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-a2enmod-rewrite-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> a2enmod rewrite</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>---

</div>### ШАГ 5 — права доступа (очень важно в WSL)

Иногда Apache не может читать Windows-диск:

<div class="" id="bkmrk-sudo-chmod--r-755-%2Fm"><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-chmod--r-755-%2Fm-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> <span class="ͼd">chmod</span> <span class="ͼf">-R</span> <span class="ͼb">755</span> /mnt/d/Soft/Freelance/Wordpress/portfolio/site</div></div></div></div></div></div></div></div></div></div></div></div></div></div>**База:**

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-mysql"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-mysql-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> mysql</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div><div class="relative w-full mt-4 mb-1" id="bkmrk-create-database-word"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-create-database-word-1"><div class="cm-scroller">  
</div><div class="cm-content q9tKkq_readonly"><span class="ͼ8">CREATE</span> <span class="ͼ8">USER</span> <span class="ͼc">'dev'</span>@<span class="ͼc">'%'</span> IDENTIFIED <span class="ͼ8">BY</span> <span class="ͼc">'password'</span>;  
<span class="ͼ8">GRANT</span> <span class="ͼ8">ALL</span> <span class="ͼ8">PRIVILEGES</span> <span class="ͼ8">ON</span> <span class="ͼ8">\*</span>.<span class="ͼ8">\*</span> <span class="ͼ8">TO</span> <span class="ͼc">'dev'</span>@<span class="ͼc">'%'</span>;  
FLUSH <span class="ͼ8">PRIVILEGES</span>;</div></div></div></div></div></div></div></div></div><div class=""><div class="">Пользователь может иметь доступ к базе отвсюду.</div><div class="">  
</div><div class="">Создайте базу данных и восстановите в нее дамп из вашего проекта на Wordpress.</div></div></div></div></div>### 🟨 ШАГ 6 — MariaDB

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-enabl"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-systemctl-enabl-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl enable mariadb  
<span class="ͼd">sudo</span> systemctl <span class="ͼd">start</span> mariadb</div></div></div></div></div></div></div></div></div></div></div></div></div>#### Проброс порта 3306 наружу (в windows)

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%9F%D1%80%D0%BE%D0%B1%D1%80%D0%B0%D1%81%D1%8B%D0%B2%D0%B0%D0%B5%D0%BC-%D0%BD%D0%B0-%D0%BF%D0%BE%D1%80%D1%82"><div class=""><div class="relative"><div class=""><div class="">Пробрасываем на порт 3307, таким образом в windows может быть экземпляр базы с портом по умолчанию, а к базе внутри WSL можно будет иметь доступ из таких приложений как DBeaver или MySQL Workbench.</div><div class="">При старте WSL он запускается в собственной сети, IP-адрес может меняться и лучше сделать стартовый скрипт, который будет это учитывать и пробрасывать порт наружу.</div></div></div></div></div>##### 🧠 Что это за файл

`fix-mysql-port.ps1` — это **PowerShell-скрипт**, который:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%B1%D0%B5%D1%80%D1%91%D1%82-%D0%B0%D0%BA%D1%82%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9-ip-"><div class=""><div class="relative"><div class=""><div class="">- берёт актуальный IP WSL
- пересоздаёт проброс порта 3307 → 3306
- чтобы не зависеть от смены IP

---

</div></div></div></div></div>##### 🥇 ГДЕ СОЗДАТЬ

Создай его в любом удобном месте, например:

<div class="relative w-full mt-4 mb-1" id="bkmrk-d%3A%5Csoft%5Cdockerdata%5Cs"><div class=""><div class="relative"><div class=""><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-d%3A%5Csoft%5Cdockerdata%5Cs-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">D:\Soft\DockerData\Scripts\fix-mysql-port.ps1</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div></div></div></div></div></div>👉 главное — чтобы путь был простой

<div class="relative w-full mt-4 mb-1" id="bkmrk--3"><div class=""><div class="relative"><div class=""><div class="">---

</div></div></div></div></div>##### 🧪 КАК СОЗДАТЬ

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%9E%D1%82%D0%BA%D1%80%D0%BE%D0%B9%D1%82%D0%B5-%D0%91%D0%BB%D0%BE%D0%BA%D0%BD%D0%BE%D1%82-%D0%B8%D0%BB%D0%B8"><div class=""><div class="relative"><div class=""><div class="">1. Откройте Блокнот или VS Code
2. Вставьте код:

</div></div></div></div></div>```
$ip = (wsl hostname -I).Trim()

netsh interface portproxy delete v4tov4 listenport=3307 listenaddress=127.0.0.1 2>$null

netsh interface portproxy add v4tov4 `
listenport=3307 listenaddress=127.0.0.1 `
connectport=3306 connectaddress=$ip

Write-Host "WSL MariaDB → localhost:3307 → $ip"
```

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%A1%D0%BE%D1%85%D1%80%D0%B0%D0%BD%D0%B8%D1%82%D0%B5-%D0%BA%D0%B0%D0%BA%3A-fix-m"><div class=""><div class="relative"><div class=""><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full">  
</div></div></div></div></div></div></div></div></div></div>3. Сохраните как:

<div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-fix-mysql-port.ps1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">fix-mysql-port.ps1</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>---

</div></div></div></div></div>##### 🚀 КОГДА ЕГО ЗАПУСКАТЬ

##### ✔ Вручную (пока проще всего)

Каждый раз:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%BF%D0%BE%D1%81%D0%BB%D0%B5-%D0%BF%D0%B5%D1%80%D0%B5%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D0%BA%D0%B0-ws"><div class=""><div class="relative"><div class=""><div class="">- после перезапуска WSL
- после перезагрузки Windows
- если не работает порт 3307

---

</div></div></div></div></div>##### 👉 запуск:

Откройте PowerShell:

<div class="relative w-full mt-4 mb-1" id="bkmrk-powershell--executio"><div class=""><div class="relative"><div class=""><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-powershell--executio-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼe">powershell</span> <span class="ͼ8">-</span><span class="ͼe">ExecutionPolicy</span> <span class="ͼe">Bypass</span> <span class="ͼ8">-</span><span class="ͼe">File</span> D:\Soft\DockerData\Scripts\fix-mysql-port.ps1</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>##### 🧠 ПОЧЕМУ ЭТО НУЖНО

<span class="hover:entity-accent entity-underline inline cursor-pointer align-baseline"><span class="whitespace-normal">WSL</span></span> меняет IP:

<div class="relative w-full mt-4 mb-1" id="bkmrk-172.31.x.x-%E2%86%92-%D0%BA%D0%B0%D0%B6%D0%B4%D1%8B%D0%B9-"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-172.31.x.x-%E2%86%92-%D0%BA%D0%B0%D0%B6%D0%B4%D1%8B%D0%B9--1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">172.31.x.x → каждый запуск новый</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>👉 поэтому static portproxy НЕ работает стабильно

---

##### 🧪 КАК ПРОВЕРИТЬ ЧТО ВСЁ ОК

После запуска скрипта:

<div class="relative w-full mt-4 mb-1" id="bkmrk-netsh-interface-port"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-netsh-interface-port-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼe">netsh</span> <span class="ͼe">interface</span> <span class="ͼe">portproxy</span> <span class="ͼe">show</span> <span class="ͼe">all</span></div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>Должно быть:

<div class="relative w-full mt-4 mb-1" id="bkmrk-127.0.0.1%3A3307-%E2%86%92-%3Cws"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-127.0.0.1%3A3307-%E2%86%92-%3Cws-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">127.0.0.1:3307 → &lt;WSL_IP&gt;:3306</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>---

##### 🧠 ВАЖНО (частая ошибка)

❌ НЕ подключайтесь в DBeaver к WSL IP  
✔ всегда используйте:

<div class="relative w-full mt-4 mb-1" id="bkmrk-127.0.0.1%3A3307"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-127.0.0.1%3A3307-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">127.0.0.1:3307</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>### 🟪 ШАГ 7 — PostgreSQL

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-enabl-2"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-systemctl-enabl-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl enable postgresql  
<span class="ͼd">sudo</span> systemctl <span class="ͼd">start</span> postgresql</div></div></div></div></div></div></div></div></div></div><div class="">Проверка работы базы:</div></div></div></div><div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-statu"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fnginx-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl <span class="ͼd">status</span> postgresql</div></div></div></div></div></div></div></div></div></div><div class="">Как и в случае с mySQL лучше сделать проброс порта наружу с другим номером. Postgres по умолчанию работает на порту 5432, делаем проброс на порт 5433. </div><div class="">Сначала будет полезно добавить или поменять пароль у пользователя postgres базы:</div></div></div></div></div></div></div></div>Зайдите через системного пользователя:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo--u-postgres-psq"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo--u-postgres-psq-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> <span class="ͼf">-u</span> postgres psql</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div></div></div></div></div></div></div></div></div>Потом:

<div class="relative w-full mt-4 mb-1" id="bkmrk-alter-user-postgres-"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-alter-user-postgres--1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼ8">ALTER</span> <span class="ͼ8">USER</span> postgres <span class="ͼ8">WITH</span> PASSWORD <span class="ͼc">'StrongPassword123!'</span>;</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div></div></div></div></div></div></div></div></div>И сразу:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%5Cpassword-postgres"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-%5Cpassword-postgres-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">\password postgres</div></div></div></div></div></div></div></div></div></div><div class="">  
</div></div></div></div></div></div></div></div></div></div></div></div>(введите новый пароль вручную дважды)

Выйти:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%5Cq"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fnginx"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-%5Cq-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">\q</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%9F%D0%BE-%D1%83%D0%BC%D0%BE%D0%BB%D1%87%D0%B0%D0%BD%D0%B8%D1%8E-postgre"><div class=""><div class="relative"><div class="">По умолчанию Postgres слушает localhost, поэтому нужно поправить конфиги, чтобы проброс порта был успешным.</div><div class="">  
</div></div></div></div>#### ✅ Проверить в WSL

Выполните:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-ss--tulpn-%7C-gre"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-ss--tulpn-%7C-gre-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> ss <span class="ͼf">-tulpn</span> | <span class="ͼd">grep</span> <span class="ͼb">5432</span></div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div>  
</div></div></div></div>##### Что должно быть хорошо:

<div class="relative w-full mt-4 mb-1" id="bkmrk-0.0.0.0%3A5432"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-0.0.0.0%3A5432-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">0.0.0.0:5432</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div></div></div></div></div>или

<div class="relative w-full mt-4 mb-1" id="bkmrk-%2A%3A5432"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-%2A%3A5432-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">*:5432</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div>  
</div></div></div></div>##### Если плохо:

<div class="relative w-full mt-4 mb-1" id="bkmrk-127.0.0.1%3A5432"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-127.0.0.1%3A5432-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">127.0.0.1:5432</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div></div></div></div></div>или

<div class="relative w-full mt-4 mb-1" id="bkmrk-localhost%3A5432"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-localhost%3A5432-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">localhost:5432</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div></div></div></div></div>Тогда внешний доступ из Windows через portproxy не работает.

<div class="relative w-full mt-4 mb-1" id="bkmrk--6"><div class=""><div class="relative"><div class="">---

</div></div></div></div>#### 🥇 Как исправить

##### 1. Открыть конфиг PostgreSQL

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fpostg"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fpostg-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> nano /etc/postgresql/*/main/postgresql.conf</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div></div></div></div></div>Найдите:

<div class="relative w-full mt-4 mb-1" id="bkmrk-%23listen_addresses-%3D-"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-%23listen_addresses-%3D--1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">\#listen_addresses = 'localhost'</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div></div></div></div></div>Замените на:

<div class="relative w-full mt-4 mb-1" id="bkmrk-listen_addresses-%3D-%27"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-listen_addresses-%3D-%27-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">listen_addresses = '*'</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div>  
</div></div></div></div>##### 2. Разрешить подключение

Откройте:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fpostg-2"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fpostg-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> nano /etc/postgresql/*/main/pg_hba.conf</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div></div></div></div></div>Добавьте строку:

<div class="relative w-full mt-4 mb-1" id="bkmrk--7"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk--8"><div class="cm-scroller"></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div class="relative w-full mt-4 mb-1" id="bkmrk-host-all-all-172.31."><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class="pe-11 pt-3"><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-host-all-all-172.31.-1"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly">host all all 172.31.32.1/32 scram-sha-256</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div></div></div></div></div>(если у вас в Windows есть уже запущенный Postgres и у него адрес именно такой)

<div class="relative w-full mt-4 mb-1" id="bkmrk--9"><div class=""><div class="relative"><div class="">  
</div></div></div></div>##### 3. Перезапустить PostgreSQL

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-resta-2"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-systemctl-resta-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl <span class="ͼd">restart</span> postgresql</div></div></div></div></div></div></div></div></div></div><div class=""></div></div></div></div>  
</div></div></div></div>#### 🥇 Потом проверить снова

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-ss--tulpn-%7C-gre-2"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-ss--tulpn-%7C-gre-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> ss <span class="ͼf">-tulpn</span> | <span class="ͼd">grep</span> <span class="ͼb">5432</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>#### Проброс порта:

По аналогии с mySql нужно внести изменения в файл **start-dev-db.ps1**

<div class="relative w-full mt-4 mb-1" id="bkmrk-%D0%92%D0%BE%D1%82-%D0%BF%D0%BE%D0%BB%D0%BD%D0%BE%D0%B5-%D1%81%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC%D0%BE"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class="">Вот полное содержимое файла для обоих серверов баз данных:</div><div class=""></div></div></div></div></div></div></div>```
$ip = (wsl hostname -I).Trim()

netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=3307
netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=5433


netsh interface portproxy add v4tov4 `
  listenport=3307 listenaddress=127.0.0.1 `
  connectport=3306 connectaddress=$ip

netsh interface portproxy add v4tov4 `
  listenport=5433 listenaddress=127.0.0.1 `
  connectport=5432 connectaddress=$ip

Write-Host ""
Write-Host "Portproxy rules:"
netsh interface portproxy show all


Write-Host ""
Write-Host "Ready:"
Write-Host "MariaDB    -> 127.0.0.1:3307"
Write-Host "PostgreSQL -> 127.0.0.1:5433"
```

<div class="relative w-full mt-4 mb-1" id="bkmrk--10"><div class=""><div class="relative"><div class=""><div class="relative w-full mt-4 mb-1"><div class=""><div class=""></div></div></div>---

</div></div></div><div class="">  
</div></div>### 🌐 ШАГ 8 — Nginx (главный вход)

Конфиг:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-nano-%2Fetc%2Fnginx-2"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-nano-%2Fetc%2Fnginx-3"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> nano /etc/nginx/sites-available/default</div></div></div></div></div></div></div></div></div></div></div></div></div>#### 📌 Конфигурация

Примерное содержимое файла:

```
server {
	listen 8081 default_server;
	listen [::]:8081 default_server;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		proxy_pass http://127.0.0.1:8082;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}

}

```

<div class="relative w-full mt-4 mb-1" id="bkmrk--11"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative">  
</div></div></div></div></div></div></div></div>#### Перезапуск Nginx:

<div class="relative w-full mt-4 mb-1" id="bkmrk-sudo-systemctl-resta-4"><div class=""><div class="relative"><div class="h-full min-h-0 min-w-0"><div class="h-full min-h-0 min-w-0"><div class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"><div class="h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback"><div class="relative"><div class=""><div class="relative z-0 flex max-w-full"><div class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼ5 ͼj" dir="ltr" id="bkmrk-sudo-systemctl-resta-5"><div class="cm-scroller"><div class="cm-content q9tKkq_readonly"><span class="ͼd">sudo</span> systemctl <span class="ͼd">restart</span> nginx</div></div></div></div></div></div></div></div></div></div><div class=""><div class="">  
</div></div></div></div></div>