45 lines
1.2 KiB
Nginx Configuration File
45 lines
1.2 KiB
Nginx Configuration File
|
A
|
# nginx configuration for eSIM provisioning captive portal
|
||
|
|
# Install: cp configs/nginx.conf /etc/nginx/sites-available/esim-provisioning
|
||
|
|
# ln -s /etc/nginx/sites-available/esim-provisioning /etc/nginx/sites-enabled/
|
||
|
|
# rm -f /etc/nginx/sites-enabled/default
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80 default_server;
|
||
|
|
server_name _;
|
||
|
|
|
||
|
|
# Redirect bare root to activation portal
|
||
|
|
location = / {
|
||
|
|
return 302 http://192.168.4.1/activate;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Serve captive portal static files
|
||
|
|
location /activate {
|
||
|
|
alias /opt/esim-provisioning/portal/;
|
||
|
|
index index.html;
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /css/ {
|
||
|
|
alias /opt/esim-provisioning/portal/css/;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /js/ {
|
||
|
|
alias /opt/esim-provisioning/portal/js/;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Reverse proxy API calls to Flask backend
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://127.0.0.1:5000;
|
||
|
|
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_connect_timeout 10s;
|
||
|
|
proxy_read_timeout 30s;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Catch-all: redirect anything else to the portal
|
||
|
|
location / {
|
||
|
|
return 302 http://192.168.4.1/activate;
|
||
|
|
}
|
||
|
|
}
|