nginx well-known 访问404错误

发布时间:2020/5/7 13:39:05 打印 字号:

Nginx 默认不能访问 点开头的目录,需要在配置文件中授权访问


server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;
        
         location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }
        #添加这一段
        location ~ /.well-known {
            allow all;  
	 } 
	 #或者使用伪静态 ,txt文件放在站点根目录下面 
	 rewrite /.well-known/pki-validation/(.*)$ /$1 last; }