Skip to content

Commit

Permalink
Create run-with-apache.md (#1394)
Browse files Browse the repository at this point in the history
I've created a page as simple as I could. Feel free to tell me if you
want me to change anything.

---------

Co-authored-by: Yuri Astrakhan <[email protected]>
  • Loading branch information
agenceKanvas and nyurik authored Jul 2, 2024
1 parent 01d01a6 commit d270e8f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Running with Docker](run-with-docker.md)
- [Running with Docker Compose](run-with-docker-compose.md)
- [Running with NGINX](run-with-nginx.md)
- [Running with Apache](run-with-apache.md)
- [Running in AWS Lambda](run-with-lambda.md)
- [Troubleshooting](troubleshooting.md)
- [Configuration File](config-file.md)
Expand Down
68 changes: 68 additions & 0 deletions docs/src/run-with-apache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## Using with Apache

You can run Martin behind Apache "kind of" proxy, so you can use HTTPs with it. Here is an example of the configuration file that runs Martin with Apache.

First you have to setup a virtual host that is working on the port 443.

### Enable necessary modules

Ensure the required modules are enabled:

```bash

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod headers
sudo a2enmod rewrite

```

### Modify your VHOST configuration

Open your VHOST configuration file for the domaine you're using, mydomain.tld :

```bash

sudo nano /etc/apache2/sites-available/mydomain.tld.conf

```

### Update the configuration

```apache
<VirtualHost *:443>
ServerName mydomain.tld
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mydomain
ProxyPreserveHost On
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/tiles/(.*)$
RewriteRule ^/tiles/(.*)$ http://localhost:3000/tiles/$1 [P,L]
<IfModule mod_headers.c>
RequestHeader set X-Forwarded-Proto "https"
</IfModule>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
```

### Check Configuration: Verify the Apache configuration for syntax errors

```bash

sudo apache2ctl configtest

```

### Restart Apache: If the configuration is correct, restart Apache to apply the changes

```bash

sudo systemctl restart apache2

```

0 comments on commit d270e8f

Please sign in to comment.