nginx

設定 [#j69bae79]

 # service nginx start
 nginx を起動中:                                            [  OK  ]
 # ps aux | grep nginx
 root      1351  0.0  0.0  45140  1136 ?        Ss   16:20   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
 nginx     1352  0.0  0.0  45548  1704 ?        S    16:20   0:00 nginx: worker process
 root      1355  0.0  0.0 107456   916 pts/0    S+   16:20   0:00 grep nginx
 
 # cd /etc/nginx/
 # cp -p nginx.conf nginx.conf.org
 # vi nginx.conf
 
 #worker_processes  1; <-- サーバーのCPU数と同じに変更する。変更したらworker_cpu_affinityにてCPUとnginxのプロセスを割り当て設定をする。4コアなら以下の通り。2コアなら(0101 1010;)
 worker_processes  4;
 worker_cpu_affinity 0001 0010 0100 1000;
 
 #access_log  /var/log/nginx/access.log  main; <--ログの名称を変更する。エラーログを追加する。
 access_log  /var/log/nginx/mlimg.hogehoge.jp-access.log  main;
 
 # cd /etc/nginx/conf.d
 # cp -p default.conf server-A.conf
 # vi server-A.conf
     server_name  mlimg.hogehoge.jp;
 
     access_log  /var/log/nginx/server-A.com-access.log  main;
     error_log  /var/log/nginx/server-A.com-error.log  warn;
 	
 # service nginx configtest
 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /etc/nginx/nginx.conf test is successful
 # ps aux | grep nginx | grep -v grep
 root      1584  0.0  0.0  45140  1164 ?        Ss   17:11   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
 nginx     1585  0.0  0.0  45564  2024 ?        S    17:11   0:00 nginx: worker process
 nginx     1586  0.0  0.0  45564  2068 ?        S    17:11   0:00 nginx: worker process
 nginx     1587  0.0  0.0  45564  1828 ?        S    17:11   0:00 nginx: worker process
 nginx     1589  0.0  0.0  45564  1812 ?        S    17:11   0:00 nginx: worker process