server { server_name domain.com; rewrite ^(.*)$ http://www.domain.com$1 permanent; }
nginx
Nginx and worker_connections are more than open file resource limit warning
If you encounter this warning message under Linux: 2009/03/09 21:23:19 [warn] 26827#0: 4096 worker_connections are more than open file resource limit: 1024 A solution is to use the command ulimit in nginx start script, just before lunching nginx: […] ulimit -n 65536 […]
Fix nginx increase server_names_hash_bucket_size error
When adding new virtual hosts in your nginx configuration file, you can experience this error message: # nginx -t 2008/11/13 09:37:03 [emerg] 12299#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 2008/11/13 09:37:03 [emerg] 12299#0: the configuration file /etc/nginx/nginx.conf test failed server_names_hash_bucket_size controls the maximum length of a virtual host entry (ie the …
Rotate Nginx log files under FreeBSD
To rotate your nginx log files, you can use the log file handler provided by FreeBSD: newsyslog. Configuring /etc/newsyslog.conf /var/log/nginx-access.log 644 7 1024 * JC /var/run/nginx.pid /var/log/nginx-error.log 644 7 1024 * JC /var/run/nginx.pid Before log rotation: -rw-r–r– 1 root wheel 104278002 Jul 16 11:35 nginx-access.log -rw-r–r– 1 root wheel 1509531 Jul 16 11:17 nginx-error.log After …