nginx + django uwsgi

CentOS6 にdjangoアプリを設置しようとしたら、nginxでエラーになった。
django 1.8

EC2上で Django + Nginx + uWSGI を試す - Qiita

http://unix.stackexchange.com/questions/218747/nginx-says-open-etc-nginx-conf-d-foo-conf-failed-13-permission-denied

service nginx restart
nginx: [emerg] open() "/home/aaaaaaa/app1/uwsgi_params" failed (13: Permission denied) in /etc/nginx/conf.d/app1.conf:25
nginx: configuration file /etc/nginx/nginx.conf test failed

SELinuxが原因だった。

service nginx restart
nginx: [emerg] invalid number of arguments in "uwsgi_param" directive in /home/aaaaaaa/app1/uwsgi_params:11
nginx: configuration file /etc/nginx/nginx.conf test failed

http://serverfault.com/questions/704366/error-invalid-number-of-arguments-in-uwsgi-param-directive-on-nginx-restart

http://nginx.org/en/linux_packages.html#stable

nginx の再インストール

nginxを1.10.1にする。

/etc/yum.repos.d/nginx.repo

http://qiita.com/utano320/items/0c0d9b84a9a28525bcb9

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
yum remove nginx
yum remove nginx-filesystem

Installing:
 nginx                      x86_64                      1.10.1-1.el6.ngx                         nginx                      821 k

server_names_hash_bucket_size

service nginx start
Starting nginx: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32

/etc/nginx/nginx.conf
server_names_hash_bucket_size 64;
を足した。

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;
    server_names_hash_bucket_size 64;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

連携設定

uwsgi --wsgi-file wsgi.py --socket 127.0.0.1:3031
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
    server 127.0.0.1:3031;
}