Added Apache support.
This commit is contained in:
90
README.md
90
README.md
@@ -30,10 +30,10 @@ This repository includes:
|
||||
- [Test your setup](#test-your-setup)
|
||||
- [Using the `status` command:](#using-the-status-command)
|
||||
- [Using the `test_setup` command:](#using-the-test_setup-command)
|
||||
- [Run it and make it available to use](#run-it-and-make-it-available-to-use)
|
||||
- [Create your first admin user](#create-your-first-admin-user)
|
||||
- [Expose the API](#expose-the-api)
|
||||
- [Using Nginx](#using-nginx)
|
||||
- [Using Apache](#using-apache)
|
||||
- [Legal \& Licensing](#legal--licensing)
|
||||
- [⚠️ Important Legal Notice](#️-important-legal-notice)
|
||||
|
||||
@@ -226,11 +226,11 @@ Config file loaded successfully.
|
||||
+-------------------------------------------+
|
||||
```
|
||||
|
||||
## Run it and make it available to use
|
||||
|
||||
## Create your first admin user
|
||||
|
||||
First make sure it is running by calling the `db-middleware start` command.
|
||||
|
||||
### Create your first admin user
|
||||
|
||||
We have two types of users, admin and regular (called just user), the admin can add/update/delete database connections, and create/delete normal users.
|
||||
|
||||
@@ -253,7 +253,7 @@ Enter role (admin/user): admin
|
||||
You don't need passwords for this, just the username and role.
|
||||
|
||||
|
||||
### Expose the API
|
||||
## Expose the API
|
||||
|
||||
This app currently runs on your local network only, we need to expose it so the data consumer on the Data Analysis product can access it and consume the data it provides.
|
||||
|
||||
@@ -263,7 +263,7 @@ You can use a dedicated domain, or a sub-domain of yours.
|
||||
|
||||
You can use any reverse proxy you prefer, we will guide you through Nginx and Apache.
|
||||
|
||||
#### Using Nginx
|
||||
### Using Nginx
|
||||
|
||||
Nginx is a great reverse-proxy that supports connection polling and real-time connections like Webhook and Server Site Events.
|
||||
|
||||
@@ -328,7 +328,7 @@ sudo systemctl restart nginx
|
||||
|
||||
3. Implement TLS Encryption
|
||||
|
||||
You can use and certificate provided, we'll show you how to use Certbot Setup (Let’s Encrypt TLS) to obtain a free certificate.
|
||||
You can use any certificate provider, we'll show you how to use Certbot Setup (Let’s Encrypt TLS) to obtain a free certificate.
|
||||
|
||||
Run this after Nginx is live on port 80 (ensure DNS points to your server!):
|
||||
|
||||
@@ -353,6 +353,84 @@ sudo certbot renew --dry-run
|
||||
|
||||
> Notice the **s** in http**s**
|
||||
|
||||
### Using Apache
|
||||
|
||||
1. Make sure apache is installed and upgraded
|
||||
|
||||
`sudo apt install apache2 --upgrade -y `
|
||||
|
||||
2. Create a new config file for your domain
|
||||
|
||||
`sudo nano /etc/apache2/sites-available/your_domain.conf`
|
||||
|
||||
> Adjust `your_domain.com` and port `8080` if needed.
|
||||
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
# Adjust your domain
|
||||
ServerName your_domain.com
|
||||
|
||||
LimitRequestBody 10737418240
|
||||
|
||||
Timeout 604800
|
||||
ProxyTimeout 604800
|
||||
KeepAlive On
|
||||
KeepAliveTimeout 604800
|
||||
|
||||
ProxyPreserveHost On
|
||||
|
||||
# Adjust the port if needed
|
||||
ProxyPass / http://localhost:8080/
|
||||
ProxyPassReverse / http://localhost:8080/
|
||||
|
||||
# Headers for WebSockets/real IP
|
||||
RequestHeader set Upgrade %{HTTP_UPGRADE}e
|
||||
RequestHeader set Connection "upgrade"
|
||||
RequestHeader set Host "%{Host}i"
|
||||
RequestHeader set X-Real-IP "%{REMOTE_ADDR}e"
|
||||
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}e"
|
||||
|
||||
# Disable compression (if needed for SSE)
|
||||
RequestHeader unset Accept-Encoding
|
||||
|
||||
# Buffer optimizations (similar to Nginx)
|
||||
ProxyIOBufferSize 131072
|
||||
</VirtualHost>
|
||||
|
||||
```
|
||||
|
||||
3. Enable required Apache modules
|
||||
|
||||
`sudo a2enmod proxy proxy_http headers`
|
||||
|
||||
4. Enable your site
|
||||
|
||||
`sudo a2ensite your_domain.conf`
|
||||
|
||||
5. Test & Reload Apache
|
||||
|
||||
```
|
||||
sudo apache2ctl configtest # Should say "Syntax OK"
|
||||
sudo systemctl reload apache2
|
||||
```
|
||||
|
||||
6. Implement TLS Encryption
|
||||
|
||||
You can use any certificate provider, we'll show you how to use Certbot Setup (Let’s Encrypt TLS) to obtain a free certificate.
|
||||
|
||||
|
||||
```bash
|
||||
sudo apt install certbot python3-certbot-apache -y
|
||||
sudo certbot --apache -d your_domain.com # Replace with your domain
|
||||
```
|
||||
|
||||
Certbot will auto-configure Nginx to use HTTPS and redirect HTTP → HTTPS.
|
||||
|
||||
Certificates auto-renew (add a cron job if not existing):
|
||||
|
||||
```bash
|
||||
sudo certbot renew --dry-run
|
||||
```
|
||||
|
||||
## Legal & Licensing
|
||||
### ⚠️ Important Legal Notice
|
||||
|
||||
Reference in New Issue
Block a user