d718c5a372
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / hurl (${{ matrix.example }}) (push) Has been skipped
CI / docker_push (duckdb) (push) Has been cancelled
CI / docker_push (minimal) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
2.3 KiB
2.3 KiB
SQLPage with Apache Reverse Proxy
This example demonstrates how to run SQLPage behind the popular Apache HTTP Server. This is particularly useful when you already have a server running Apache (with a PHP application for example) and you want to add a SQLPage application.
This setup allows you to:
- Host multiple websites/applications on a single server
- Serve static files directly through Apache
- Route specific paths to SQLPage
How it Works
Apache acts as a reverse proxy, forwarding requests for /my_website to the SQLPage
application while serving static content directly. The configuration uses:
mod_proxyandmod_proxy_httpfor reverse proxy functionality- Virtual hosts for domain-based routing
ProxyPassdirectives to forward specific paths
Docker Setup
The docker-compose.yml defines three services:
apache: Serves static content and routes requestssqlpage: Handles dynamic content generationmysql: Provides database storage
Native Apache Setup
To use this with a native Apache installation instead of Docker:
- Install Apache and required modules:
sudo apt install apache2
sudo a2enmod proxy proxy_http
- Configuration changes:
- Place the
httpd.confcontent in/etc/apache2/sites-available/my-site.conf - Adjust paths:
- Change
/var/wwwto your static files location - Update SQLPage URL to match your actual SQLPage server address (
http://localhost:8080/my_websiteif you are running sqlpage locally) - Modify log paths to standard Apache locations (
/var/log/apache2/)
- Change
- SQLPage setup:
- Install SQLPage on your server
- Configure it with the same
site_prefixinsqlpage.json - Ensure MySQL is accessible from the SQLPage instance
- Enable the site:
sudo a2ensite my-site
sudo systemctl reload apache2
Files Overview
httpd.conf: Apache configuration with proxy rulessqlpage_config/sqlpage.json: SQLPage configuration with URL prefixstatic/: Static files served directly by Apachewebsite/: SQLPage SQL files for dynamic content