server {
    listen 80; 
    server_name 域名;


#     if ($request_method !~ ^(GET|POST|HEAD)$ ) {
#         return 405;
#     }


    location ~ /.svn/ {
        return 404;
    }


    location ~ ^/(WEB-INF)/ {
        return 404;
    }


#     location ~ \.(apk|torrent|htm|html|asp|php|gif|jpg|jpeg|png|bmp|ico|rar|css|js|zip|map|java|jar|txt|flv|swf|mid|doc|ppt|xls|pdf|txt|mp3|wma)$ {
#         root D:/Servers/ceshiServer/webapps/ROOT;
#         access_log off;
#         expires 30d;
#     }
location / {
root D:/Servers/ceshiServer/webapps/ROOT;
        proxy_pass http://ceshi_server;
        #access_log off;
        include _proxy.conf;
    }
  

}

 

这是以前的配置文件,可以支持域名访问,ip也能访问,禁止ip访问只需加上一段话

 

 

server{ 
listen 80 default; 
server_name _; 
return 404; 
}

 

 

完整配置

server{ 
listen 80 default; 
server_name _; 
return 404; 
}

server {
    listen 80; 
    server_name 域名;


#     if ($request_method !~ ^(GET|POST|HEAD)$ ) {
#         return 405;
#     }


    location ~ /.svn/ {
        return 404;
    }


    location ~ ^/(WEB-INF)/ {
        return 404;
    }


#     location ~ \.(apk|torrent|htm|html|asp|php|gif|jpg|jpeg|png|bmp|ico|rar|css|js|zip|map|java|jar|txt|flv|swf|mid|doc|ppt|xls|pdf|txt|mp3|wma)$ {
#         root D:/Servers/ceshiServer/webapps/ROOT;
#         access_log off;
#         expires 30d;
#     }
location / {
root D:/Servers/ceshiServer/webapps/ROOT;
        proxy_pass http://ceshi_server;
        #access_log off;
        include _proxy.conf;
    }
  

}

相关文章:

  • 2021-11-06
  • 2021-11-20
  • 2021-11-01
  • 2021-11-01
  • 2020-04-27
  • 2021-11-20
  • 2021-09-27
  • 2021-11-27
猜你喜欢
  • 2021-09-18
  • 2021-11-16
  • 2021-11-01
  • 2021-11-20
  • 2021-11-01
  • 2021-11-20
  • 2021-11-29
  • 2021-11-16
相关资源
相似解决方案