Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create run-with-apache.md #1394

Merged
merged 5 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

```