配置Nginx防止直接用IP访问Web服务器
潜水4,470人话说Nginx默认配置是允许以ip直接访问web服务器的,很多时候搜索引擎也会收录ip网址,不知是否对SEO优化不利,但还是阻止一下吧!
# vi /usr/local/nginx/conf/nginx.conf
server { listen 80 default_server; server_name _; return 444; }
注:当以ip访问web服务器的时候,返回444错误,问题解决了,但对用户体验来说很不友好……