Nginx 1



# aptitude install nginx-naxsi-ui

Nginx

/etc/nginx/nginx.conf
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile    10240; #65535

events {
use epoll;
worker_connections 10240; #65535
# version number
server_tokens off

#/etc/init.d/nginx reload

一般來說
  • Nginx 502 Bad Gateway和 php-fpm.conf 的設置有關
  • Nginx 504 Gateway Time-out則是與 nginx.conf 的設置有關
#vi /etc/default/nginx
# Note: You may want to look at the following page before setting the ULIMIT.
# Set the ulimit variable if you need defaults to change.
#  Example: ULIMIT="-n 4096"
#ULIMIT="-n 4096"
ULIMIT="-n 65536"



ulimit
/etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
# ulimit -SHn 65536
# ulimit -a


# vi /etc/logrotate.d/nginx
/var/log/nginx/*.log {
        daily
        missingok
        # rotate 52
        rotate 5
        compress
        delaycompress
        notifempty
        create 0640 www-data adm
        sharedscripts
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi; \
        endscript
        postrotate
                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
        endscript
}

# /usr/sbin/logrotate -f /etc/logrotate.d/nginx
  • Webmin - System
    • Log File Rotation
    • Scheduled Cron Jobs



Comments