zoukankan      html  css  js  c++  java
  • windows下nginx问题:[crit] 796#7096: *1 GetFileAttributesEx() "F: ginx-1.12.2htmldist" failed (123: The filename, directory name, or volume label syntax is incorrect), client: 127.0.0.1, server: localho

    错误信息:

    2019/09/09 13:54:37 [crit] 796#7096: *1 GetFileAttributesEx() "F: ginx-1.12.2htmldist" failed (123: The filename, directory name, or volume label syntax is incorrect), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8081"

    说明:本机windows环境下   玩nginx部署vue项目的时候, 访问http://localhost:8081/  出现了错误页面

     然后我就去看日志,就是上边的错误信息。发现 错误信息中 应该是 nginx-1.12.2结果却是 ginx-1.12.2 。

    原因:windows和linux不一样,windows中默认是 反斜杠\\\\\\  而linux确是斜杠//////  结果根路径F: ginx-1.12.2 中的  就会被当成是换行,被转义处理。

    解决办法:配置vue资源根目录的时候   F:\nginx-1.12.2htmldist     双反斜杠表示不转义。如果是linux就不会存在这个问题 我已经测试了

    下边是windows的 nginx配置文件:

    //

    #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;

    server {
    listen 8081;
    server_name localhost;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {

    #vue项目的根路径 windows是双反斜杠
    root F:\nginx-1.12.2htmldist;
    index index.html index.htm;

    try_files $uri $uri/ /index.html;
    }
    #访问后台接口的代理
    location /api/ {
    proxy_pass http://localhost:8080/;
    }

    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }

    #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;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ .php$ {
    # proxy_pass http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ .php$ {
    # root html;
    # fastcgi_pass 127.0.0.1:9000;
    # fastcgi_index index.php;
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    # include fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /.ht {
    # deny all;
    #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

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


    # HTTPS server
    #
    #server {
    # listen 443 ssl;
    # server_name localhost;

    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_cache shared:SSL:1m;
    # ssl_session_timeout 5m;

    # ssl_ciphers HIGH:!aNULL:!MD5;
    # ssl_prefer_server_ciphers on;

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

    }

  • 相关阅读:
    判断当前时间为星期几
    springboot+mysql数据源切换
    表单上传图片
    po,vo,bo,dto,dao解释
    生成电脑的SSH key
    单例模式
    事物的特性和隔离级别
    springAOP自定义注解讲解
    Spring依赖注入(DI)的三种方式
    redis持久化
  • 原文地址:https://www.cnblogs.com/xuchao0506/p/11491621.html
Copyright © 2011-2022 走看看