nginx常用配置记录

日志查询:

日志位置:

配置文件nginx.conf(默认路径:/etc/nginx/nginx.conf):

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

日志格式:

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

配置文件和启动

nginx启动、停止、无间断服务重启
service nginx start  |  ./nginx
service nginx stop   |  kill -9 进程号
service nginx reload  |  nginx -s reload
Table of Contents