In a YunoHost server, Nginx is the web server used by default, and its configuration files are organized systematically to handle the server and each application.
Nginx Configuration File Locations in YunoHost:
Main Nginx Configuration:
- Path:
/etc/nginx/nginx.conf
- Purpose: The global configuration for Nginx. Avoid making changes here unless absolutely necessary.
YunoHost-Specific Configuration:
- Path:
/etc/nginx/conf.d/
- Files in this directory are included in the main configuration. Some important ones include:
/etc/nginx/conf.d/yunohost_admin.conf
: Configuration for the YunoHost admin panel.
/etc/nginx/conf.d/yunohost_api.conf
: Configuration for the YunoHost API.
Domain-Specific Configurations:
- Path:
/etc/nginx/conf.d/<your-domain>.d/
- Each domain served by YunoHost has its own directory. For example:
/etc/nginx/conf.d/hao8o.com.d/
- Files:
custom_server.conf
: For custom server block directives.
custom_http.conf
: For custom HTTP configurations.
custom_https.conf
: For custom HTTPS configurations.
Application-Specific Configurations:
- Path:
/etc/nginx/conf.d/<your-domain>.d/<app>.conf
- Each app installed on a domain has its own configuration file here. For example:
/etc/nginx/conf.d/hao8o.com.d/piped.conf
: For an app like Piped.
Steps to Modify Nginx Configuration on YunoHost:
Check the Existing Configuration:
ls -l /etc/nginx/conf.d/<your-domain>.d/
Edit the Configuration:
Use a text editor like nano
or vim
to make changes:
sudo nano /etc/nginx/conf.d/<your-domain>.d/custom_server.conf
Test the Configuration:
Always test the configuration for syntax errors before reloading:
sudo nginx -t
Reload Nginx:
Apply the changes by reloading Nginx:
sudo systemctl reload nginx
Tips for YunoHost:
- Avoid directly editing autogenerated files (e.g.,
yunohost_admin.conf
) because updates or reconfiguration may overwrite them.
- Use
custom_server.conf
, custom_http.conf
, or custom_https.conf
for domain-specific customizations.
- If an app isn't behaving as expected, review its
.conf
file for misconfigurations.
Let me know if you need help troubleshooting or customizing specific settings!