Nginx进阶

2019-10-09  本文已影响0人  魔曦帝天

nginx 日志文件详解

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


$remote_addr和$http_x_forwarded_for客户端的ip
$remote_user 客户端的名称
$time_local 访问时的本地时间
$request 请求的URL和http协议
$status 访问的状态码
$body_bytes_sent 发送给客户端的主体内容大小
$http_referer   记录客户端是从哪个页面链接访问过来的,若没有链接,
则访问‘-’
$http_user_agent   记录客户端使用的浏览器的相关信息
  location /lys {  # 类似路由
  alias /usr/share/nginx;  # 存放文件的路径 
  index index.html;    # 实际访问的页面(需要自己创建)

 
}
image.png

监听

image.png
image.png

nginx 虚拟机配置

基于域名的虚拟主机

上一篇 下一篇

猜你喜欢

热点阅读