Reverse Proxy
Nginx
Nginx is a web server that can be used as a reverse proxy.
Overview
This guide explains how to deploy Kaneo using Nginx as a reverse proxy. This setup is ideal for production environments where you want to expose Kaneo through a domain name with HTTPS.
Prerequisites
- A domain name
- A SSL certificate
- A Nginx web server
Installation
The first step is to make sure nginx is installed and running.
sudo apt update
sudo apt install nginxConfiguration
The next step is to configure Nginx to proxy requests to the Kaneo services. We will create two servers, one for the web application and one for the API.
- Create a new file in the
/etc/nginx/sites-available/kaneo.confdirectory.
server {
listen 80;
server_name kaneo.your-domain.com;
location / {
proxy_pass http://localhost:5173;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name kaneo-api.your-domain.com;
location / {
proxy_pass http://localhost:1337;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}- Enable the configuration by creating a symlink to the
sites-enableddirectory.
sudo ln -s /etc/nginx/sites-available/kaneo.conf /etc/nginx/sites-enabled/- Test the configuration.
sudo nginx -t- Restart Nginx to apply the changes.
sudo systemctl restart nginxKey points
- This configuration is for a single server, if you want to use a load balancer, you need to configure it accordingly.
- This configuration is for a single domain, if you want to use a subdomain, you need to configure it accordingly.