ssh-keygen -t rsa -b 4096 -C "[email protected]"
import sys | |
from io import BytesIO | |
from PIL import Image | |
import xml.etree.cElementTree as et | |
from django.core.exceptions import ValidationError | |
from django.forms import ImageField as DjangoImageField | |
from django.utils import six | |
On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:
2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files)
2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...
An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.
- * Instead of using
su
to runulimit
on the nginx account, useps aux | grep nginx
to locate nginx's process IDs. Then query each process's file handle limits usingcat /proc/pid/limits
(wherepid
is the process id retrieved fromps
). (Note:sudo
may be necessary on your system for thecat
command here, depending on your system.) - Added
fs.file-max = 70000
to /etc/sysctl.conf
Most of programs will not accept an email using just @localhost as domain.
So, edit /etc/hosts
file to make the domain localhost.com point to your machine, including this content to the file:
127.0.0.1 localhost.com
#!/usr/bin/env python | |
#coding=utf8 | |
from cStringIO import StringIO | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.header import Header | |
from email import Charset | |
from email.generator import Generator | |
from email.utils import formataddr | |
import smtplib |
#coding: utf-8 | |
from cStringIO import StringIO | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.header import Header | |
from email import Charset | |
from email.generator import Generator | |
import smtplib | |
# Example address data |