Where config files live: nginx, Apache, MySQL, PostgreSQL, Redis and PHP on every OS
The same program keeps its settings in different places on each system, and there is often more than one copy: one that came with the OS, one from a package manager, and one from an old install. Before you edit or delete anything, ask the program which file it actually reads. The command is in the last column.
Configuration files
| Program | Ubuntu / Debian | RHEL / Fedora / Rocky | macOS (Homebrew, Apple silicon) | Windows | Ask the program |
|---|---|---|---|---|---|
| nginx | /etc/nginx/nginx.conf, sites-available/, sites-enabled/, conf.d/ | /etc/nginx/nginx.conf, conf.d/ | /opt/homebrew/etc/nginx/nginx.conf (Intel: /usr/local/etc/nginx) | conf\nginx.conf inside the unzipped folder | nginx -t prints the file; nginx -T prints everything it loads |
| Apache | /etc/apache2/apache2.conf, sites-enabled/, mods-enabled/ | /etc/httpd/conf/httpd.conf, conf.d/ | /opt/homebrew/etc/httpd/httpd.conf | XAMPP: C:\xampp\apache\conf\httpd.conf | apachectl -V or httpd -V (SERVER_CONFIG_FILE) |
| MySQL / MariaDB | /etc/mysql/my.cnf plus conf.d/ and mysql.conf.d/ | /etc/my.cnf, /etc/my.cnf.d/ | /opt/homebrew/etc/my.cnf | C:\ProgramData\MySQL\MySQL Server 8.0\my.ini | mysqld --verbose --help | grep -A1 "Default options" |
| PostgreSQL | /etc/postgresql/<ver>/main/postgresql.conf | /var/lib/pgsql/<ver>/data/postgresql.conf | /opt/homebrew/var/postgresql@<ver>/postgresql.conf | C:\Program Files\PostgreSQL\<ver>\data\postgresql.conf | psql -c "SHOW config_file;" |
| Redis | /etc/redis/redis.conf | /etc/redis/redis.conf (older: /etc/redis.conf) | /opt/homebrew/etc/redis.conf | Not officially supported; use WSL or Memurai | redis-cli CONFIG GET dir |
| PHP | /etc/php/<ver>/fpm/php.ini and cli/php.ini | /etc/php.ini, /etc/php.d/ | /opt/homebrew/etc/php/<ver>/php.ini | Where you installed PHP, php.ini | php --ini |
| SSH server | /etc/ssh/sshd_config | /etc/ssh/sshd_config | /etc/ssh/sshd_config | C:\ProgramData\ssh\sshd_config | sshd -T (as root) |
| hosts file | /etc/hosts | /etc/hosts | /etc/hosts | C:\Windows\System32\drivers\etc\hosts | - |
Data and log folders (where the space goes)
| Program | Data | Logs |
|---|---|---|
| nginx | (no data; site root is whatever you set, often /var/www) | /var/log/nginx/; Homebrew /opt/homebrew/var/log/nginx/ |
| Apache | site root, often /var/www/html or /var/www | Debian /var/log/apache2/; RHEL /var/log/httpd/ |
| MySQL | /var/lib/mysql; Windows C:\ProgramData\MySQL\MySQL Server 8.0\Data; Homebrew /opt/homebrew/var/mysql | Debian /var/log/mysql/; binary logs live in the data folder and can grow large |
| PostgreSQL | Debian /var/lib/postgresql/<ver>/main; RHEL /var/lib/pgsql/<ver>/data | Debian /var/log/postgresql/ |
| Redis | /var/lib/redis (dump.rdb, append-only file) | /var/log/redis/ |
Leftovers when you uninstall
Removing the package normally keeps your config and data on purpose. On Ubuntu, apt remove keeps /etc files; apt purge removes them, but never the database folders in /var/lib. On macOS, brew uninstall leaves /opt/homebrew/var data. If you are done with a database, export what you need first, then delete the data folder yourself. See what uninstalled apps leave behind.
Where Zofle fits. Zofle is a free disk cleanup and file finder for Mac and Windows. It shows what is filling a disk, folder by folder, lists developer caches, old build folders and leftovers with their size and date, lets you untick what you want to keep, and sends the rest to the Trash or Recycle Bin first so you can undo it.
Sources and method
- Official documentation: nginx (nginx.org), Apache HTTP Server (httpd.apache.org), MySQL Reference Manual (option files), PostgreSQL documentation (file locations), Redis documentation, PHP manual (configuration file).
- Homebrew documentation for the Apple silicon prefix
/opt/homebrew. - Paths and commands are from each tool's own documentation and can differ by version; run the 'find it' command on your own machine before deleting anything.
Zofle Pro news
People signing up now will get Zofle Pro, with more features, for free when we launch it.