Custom Nginx Configuration
Appliku automatically generates an Nginx configuration for each application, handling SSL termination, reverse proxying, and domain routing. In some cases, you may need to customize this configuration.
Default Behavior
By default, Appliku regenerates the Nginx configuration on every deployment. This ensures the config stays in sync with your application's domain and process settings.
Disabling Auto-Update
To preserve custom Nginx changes across deployments:
- Go to your application's Build Settings
- Uncheck Update Nginx on Deploy
- Save the settings
When "Update Nginx on Deploy" is disabled, Appliku will not overwrite your custom Nginx configuration during deployments. However, it also means that any domain changes you make in the dashboard will not automatically update the Nginx config -- you will need to update it manually.
Making Custom Changes
Step 1: Locate the Nginx Config
SSH into your server and find the Nginx configuration file for your application:
ssh app@<your-server-ip>
ls /etc/nginx/sites-enabled/
The file is named after your application.
Step 2: Edit the Configuration
Open the file with a text editor:
sudo nano /etc/nginx/sites-enabled/<your-app-config>
Step 3: Test and Reload
Always test the configuration before reloading:
sudo nginx -t
sudo systemctl reload nginx
Common Customizations
Increase Upload Size Limit
The default client_max_body_size may be too small for applications that handle large file uploads:
client_max_body_size 100M;
Increase Proxy Timeouts
For long-running requests (e.g., report generation, file processing):
proxy_read_timeout 300s;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
Add Custom Headers
Add security or caching headers:
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
Enable Gzip Compression
Compress responses to reduce bandwidth usage:
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
gzip_min_length 1000;
After making changes, always run sudo nginx -t to check for syntax errors before reloading. A misconfigured Nginx can take down all applications on the server.
Restoring the Default Configuration
If you need to revert to the auto-generated configuration:
- Re-enable Update Nginx on Deploy in your build settings
- Trigger a new deployment
Appliku will regenerate the Nginx configuration and overwrite your custom changes.