0

当我打开 127.0.0.1 时,url 会跳转到 127.0.0.1/k.com/k.com/k/.com/......

我的主人

127.0.0.1 localhost
127.0.0.1 k.com

我的 nginx 配置

#user  _www;
worker_processes  1;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}

http {
    access_log off;
    gzip off;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types text/plain application/json application/x-javascript text/css application/xml text/javascript;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;



    server {
        listen       80;
        server_name  k.com;

        client_max_body_size 20M;

        root         F:/xxxx/www; 
        underscores_in_headers on;
        index        index.html;


        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,username,password,remember,token';         


        location / {
            try_files $uri $uri/ /index.html;
        }

        location = /index.html {
            add_header Cache-Control no-cache;
            add_header Cache-Control private;
        }



    }

    server {
        listen       80;
        server_name  localhost;
        root         F:/xxxx/www/htdocs; #
        index        index.html index.php;
        autoindex    on;

        location / {
            try_files $uri $uri/ /index.html;
        }


    }
}

如何配置 127.0.0.1 ,直接到另一个目录或空页面,或者直接到本地主机。

4

0 回答 0