Nginx 简单配置方法

1、Nginx 作用

  •   支持数以百万级别的TCP连接
  •   跨平台服务器
  •   负载均衡,通过反向代理服务器来优化网站的负载

2、Nginx 下载地址

 http://nginx.org/en/download.html

3、Nginx 简单配置

 将压缩包解压在没有中文名称的目录下(含中文名称的目录会使Nginx运行失败

  点击打开conf文件夹

 

 

打开nginx.conf 文件 修改内容,如已下内容,对于Nginx 的一些简单配置就完成了。

#gzip  on;

    upstream server_qd{
        server 127.0.0.1:8072 weight=2 max_conns=800 max_fails=1  fail_timeout=20;
        server 127.0.0.1:8096 weight=4;
    }

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        proxy_pass http://server_qd;
        proxy_cookie_path /project /proxy_path;
        }
View Code

 

nginx 的启动、关闭与重启

打开cmd(不需要管理员),进入对应的目录

启动:
start nginx

重载:
nginx.exe -s reload

停止:
nginx.exe -s stop
View Code

service 中  listen 是端口

posted @ 2019-08-06 15:09  ぃ流年☆  阅读(216)  评论(0编辑  收藏  举报