nginx configuration
This guide explains how to configure nginx to run Zittme. If you use Apache, you do not need this document. The .htaccess in the distribution handles it for you.
The easiest way: setup helpers
Zittme provides helpers that generate your nginx configuration. Use whichever is most convenient.
- Environment check screen in the installation wizard: If short URLs (rewrite) are not set up, it detects your server environment and generates a tailored configuration and the commands to apply it. Just copy and paste.
- Short URL helper in Admin > System settings: The same feature is available after installation.
- One-step script:
common/scripts/setup-nginx.shin the distribution
To configure it yourself, see below.
Configuration file location
| Distribution | Site configuration |
|---|---|
| Ubuntu / Debian | /etc/nginx/sites-available/ (enable with a symbolic link in sites-enabled/) |
| CentOS / RHEL | /etc/nginx/conf.d/ |
Server block example
common/manual/server_config/zittme-nginx.conf in the distribution contains the full rules. The skeleton looks like this.
server {
listen 80;
server_name example.com;
root /var/www/mysite;
index index.php index.html;
client_max_body_size 32m;
# 여기에 zittme-nginx.conf 의 규칙(차단·rewrite)을 넣거나 include 합니다
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}rootis the Zittme installation path, andindexmust includeindex.php.client_max_body_sizeis the allowed upload size. Adjust it to fit your attachment sizes.- The PHP-FPM socket path differs by server. Check it with
ls /run/php/, or use the port form (fastcgi_pass 127.0.0.1:9000;).
Mind the rule order
Zittme's rewrite rules already include a location / { try_files ... } block. Adding the same block again in your site configuration causes an error. Place the blocking rules (location blocks) before the PHP handling block.
Apply and verify
nginx -t
systemctl reload nginxnginx -t should print ok. If there is a problem, check /var/log/nginx/error.log.
Security blocking rules
zittme-nginx.conf includes rules that block direct web access to template, configuration, and cache files. Even if you write your own configuration, always include these blocking rules. If you leave them out, template sources and internal files may be exposed to the outside.