# 5.) Installing Nginx

\- connect via ssh to your pi

\- we create now a directory for nginx, a config.json file and a docker-compose.yml

\- go to your dockerdata directory; here it ist /media/dockerdata

\- type in:

```shell
cd /media/dockerdata
```

-type in:

```shell
sudo mkdir
```

\- type in:

```shell
cd nginx
```

\- type in:

```shell
nano docker-compose.yml
```

\- paste in: but <span style="text-decoration: underline;">change</span> the DB\_MYSQL\_PASSWORD

```YAML
version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
    environment:
      # These are the settings to access your db
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"     # please change this
      DB_MYSQL_NAME: "npm"
      # If you would rather use Sqlite uncomment this
      # and remove all DB_MYSQL_* lines above
      # DB_SQLITE_FILE: "/data/database.sqlite"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'      # same as above
    volumes:
      - ./data/mysql:/var/lib/mysql
```

\- paste in:

```shell
docker-compose up -d
```

\- now you have access via webbrowser for your nginx proxy manager : [http://ip-adress-of-your-pi:81](http://ip-adress-of-your-pi:81)

\- on first login the credentials are

username: admin@example.com  
passwrod: changeme

\- create your hosts you need

##### For Apple Users:

You must add an additional line in your nginx config to avoid parsing errors

1.)

-edit your Nexcloud Proxy Host.

-go to advanced

[![nginx-apple.png](https://bookstack.borghoff.ddnss.de/uploads/images/gallery/2022-05/scaled-1680-/nf3BzN2GUZUYX37K-nginx-apple.png)](https://bookstack.borghoff.ddnss.de/uploads/images/gallery/2022-05/nf3BzN2GUZUYX37K-nginx-apple.png)

\- type in:

proxy\_hide\_header Upgrade;

2.)

\- connect via ssh to your pi

\- type in:

sudo nano /etc/apache2/apache2.conf

\- after this line : Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

\- type in:

Header unset Upgrade

\- save and exit (Strg+x, y, enter)

\- reboot