zoukankan      html  css  js  c++  java
  • nginx windows 下配置

    1.下载nginx

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

    2.查看系统80端口占用情况

    netstat -ano |findstr "80"

    如果是其他软件占了端口号  直接关掉进程就OK

     TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4

    如果端口占用是系统  

    net stop http 停止http 服务

    下面的服务依赖于 HTTP Service 服务。
    停止 HTTP Service 服务也会停止这些服务。

    World Wide Web 发布服务
    SSDP Discovery
    Print Spooler

    你想继续此操作吗? (Y/N) [N]: Y

    并禁用服务 

    Sc config http start= disabled

    停止后重启电脑   发现80端口正常了   

    启动nginx      nginx.exe

    启动成功页面

    配置nginx 

    打开 D: ginx-1.16.0conf ginx.conf


    #user nobody;
    worker_processes 1;

    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;


    events {
    worker_connections 1024;
    }


    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 logs/access.log main;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;

    #gzip on;
    upstream xxx.xxx.com {
    server 127.0.0.1:81;
    }
    server {
    listen 80;
    server_name localhost;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
    proxy_pass http://xxx.xxx.com;
    }

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }

    server {
    listen 80;
    server_name localhost;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
    root html;
    index index.html index.htm;
    }

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }

    }



    }

    配置完成之后  nginx -s reload

     之后就可以正常访问了

    启动  net start http

    C:WINDOWSsystem32>net start http
    发生系统错误 1058。

    无法启动服务,原因可能是已被禁用或与其相关联的设备没有启动。

    需要修改服务配置

    sc config http start= demand & net start http

    服务正常启动  

  • 相关阅读:
    五条面试忠告
    NET平台微服务
    CentOS,net core2 sdk nginx、supervisor、mysql
    搭建基于java环境
    产生唯一随机码的方法分析
    SpringBoot JPA 专题
    关于 MySQL 的 boolean 和 tinyint(1)
    org.springframework.data.mapping.PropertyReferenceException: No property created found for type
    交流心得
    github如何删除一个repository(仓库)
  • 原文地址:https://www.cnblogs.com/xiaoxiangpaou/p/10880513.html
Copyright © 2011-2022 走看看