Closed DSMejantel closed 2 months ago
You can run the two applications by specifying different values for the port
configuration variable for the two applications, and omitting https_domain
.
If you want to run both applications on the same port (HTTPS on port 443, or HTTP on port 80) for instance, you will need to put a reverse proxy such as nginx between the public web and your application.
The reverse proxy will receive requests, and based on their contents, decide which SQLPage instance to forward them to.
sudo apt-get install nginx
on Ubuntu./etc/nginx/sites-available/
:HTTP configuration for site1 (site1-http.conf):
server {
listen 80;
server_name site1.com;
location / {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
HTTP configuration for site2 (site2-http.conf):
server {
listen 80;
server_name site2.com;
location / {
proxy_pass http://localhost:8082;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
sudo certbot --nginx -d site1.com -d site2.com
sudo ln -s /etc/nginx/sites-available/site1-http.conf /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/site2-http.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Note the logs in the post above demonstrate a bug in sqlpage when trying to listen on both https and http (when the configuration file contains both a non-443 port and an
https_domain
entry). This is not related to multisite installations, but I will try to fix it soon. The bug is in https://github.com/lovasoa/SQLpage/blob/main/src/webserver/http.rs#L523-L529 SQLPage tries to bind to the http port twice instead of binding once to the http port and once to the https port.
Introduction
When we want to launch 2 differents appli with SQLpage with 2 differents ports for example 8080 and 8081 and behind 2 https domain it's impossible to reach the server