nginx反向代理

第一步:下载:http://openresty.org/cn/download.html

 

第二步:解压->conf->nginx.conf里面的注释全部删除(方便阅读)

 

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    # default_type  application/octet-stream;        
    default_type text/html;

    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       5100;
        server_name  127.0.0.2;
        default_type text/html;
        location / {
            root   C:\Users\user\Desktop;
            # index  index.html index.htm;
        }
        location /v/ {
            proxy_pass http://127.0.0.1:5000/;
        }

        location ~ .*\.(gif|jpg|jpeg|png)$ {
            root D:/date_set/manhua/fox_red/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

  

 

常用指令:

# 启动nginx服务器
nginx

 

# 强制停止nginx服务器,如果有未处理的数据,丢弃
nginx -s stop

 

# 优雅的停止nginx服务器,如果有未处理的数据,等待处理完成之后停止
nginx -s quit

 

# 查看nginx进程是否启动 
ps -ef|grep nginx

 

# 重新载入配置文件
nginx -s reload 

 

# 重启 Nginx
nginx -s reopen 

  

posted @ 2020-02-27 14:32  知一以天  阅读(162)  评论(0编辑  收藏  举报