Nginx Portal
Pigsty installs Nginx on the INFRA Node as a web service proxy, using ports 80/443 by default.
The global parameter infra_portal configures Nginx proxy rules and upstream services.
The Nginx server configuration is specified through the infra_portal parameter.
Users declare all domains to be proxied through Nginx, along with corresponding upstream server endpoints or local directory paths.
Basic Example
Complex Example
Playbook Configuration
Nginx can be reconfigured using Ansible playbooks:
Server
Each server record in infra_portal supports the following configuration options:
Core Parameters
domain- Optional proxy domain nameendpoint- Upstream service address (IP:PORT or socket path)path- Local web server root directory for static contentscheme- Protocol specification (http/https/tcp/udp)
SSL/TLS Parameters
certbot- Enable Let’s Encrypt certificate managementcert- Custom SSL certificate file pathkey- Custom SSL private key file path
Advanced Parameters
conf- Custom Nginx configuration templatedomains- Additional domain names for the serviceindex- Enable directory listing for static contentlog- Custom log file configurationwebsocket- Enable WebSocket support for real-time applications
Parameter Usage Examples
Using Domain Names
DNS Resolution Methods
- Public internet domain via DNS provider
- Internal network DNS server
- Local
/etc/hostsfile modification
Recommended Local Configuration
For local development and testing, add entries to your /etc/hosts file:
Replace <your_public_ip_address> with your actual admin node IP address.
HTTPS Configuration
Configure HTTPS access via the nginx_sslmode parameter with the following options:
disabled- HTTP only, no SSLself-signed- Use self-signed certificates (default)provided- Use provided certificatesletsencrypt- Use Let’s Encrypt certificates
Certificate Management
HTTPS Access Methods
For self-signed certificates, you can:
- Trust the self-signed CA in your browser
- Use browser security bypass options (type
thisisunsafein Chrome) - Configure proper CA-signed certificates for production
Service Access Examples
With the default configuration, services are accessible via:
- Home Page:
http://h.pigstyorhttps://h.pigsty - Grafana Dashboard:
http://g.pigstyorhttps://g.pigsty - Prometheus Metrics:
http://p.pigstyorhttps://p.pigsty - Alertmanager:
http://a.pigstyorhttps://a.pigsty
Best Practices
- Use domain names for service access rather than direct IP:PORT
- Configure DNS resolution or update local hosts file appropriately
- Enable WebSocket support for services that require it (like Grafana, Jupyter)
- Use HTTPS in production environments with proper certificates
- Organize services logically with meaningful subdomain naming
- Monitor certificate expiration for Let’s Encrypt certificates
- Centralize web service proxy through Nginx for better management
- Use static file serving for documentation and repository browsing