windows 安装搭建 Nginx

windosw 搭建的教程
下载 nginx 安装 本教程 nginx-1.6.3 版本!一般下载的是压缩包(直接解压使用,不需要安装)
我的目录是:C:\nginx\nginx-1.6.3


然后修改 conf/nginx.conf 如下配置
#user  nobody;
worker_processes  2;  

#错误日志存放路径  
#error_log  logs/error.log;  
#error_log  logs/error.log  notice;  
error_log   logs/error.log  info; 

#指定pid存放文件  
pid        logs/nginx.pid; 


events {  
    #使用网络IO模型linux建议epoll,FreeBSD建议采用kqueue,window下不指定。  
    #use epoll;  
      
    #允许最大连接数  
    worker_connections  2048;  
} 


http {  
    include       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  off;  
    access_log  logs/access.log;  
  
    client_header_timeout  3m;  
    client_body_timeout    3m;  
    send_timeout           3m;  
   
    client_header_buffer_size    1k;  
    large_client_header_buffers  4 4k;  
  
    sendfile        on;  
    tcp_nopush      on;  
    tcp_nodelay     on;  
  
    #keepalive_timeout  75 20;  
  
    include    gzip.conf;  
   
}

保存后,在 C:\nginx\nginx-1.6.3\conf目录下 创建 gzip.conf 空文件
C:\nginx\nginx-1.6.3\logs 目录下 创建access.log 和 error.log、nginx.pid 空文件即可
然后 命令 开启 nginx 如下 步骤



命令:(常用命令可以百度)
nginx -t 是否成功
nginx -s reload 修改conf文件重启使用

nginx -c c:/nginx/xxxx/nginx.conf 重新配置


注意:没有使用命令: start nginx, 所以它没有初始化,所以就无法reload,因为reload的基础是在service start后的。


猜你喜欢

转载自blog.csdn.net/zsm136767349700/article/details/53743156