試圖讓我們使用webroot方法加密安裝程序,該方法創建並需要訪問./.well-known/acme-challenge/目錄中的文件。那裏的一切(包括我加入了手動測試文件)顯示爲404Nginx權限問題(404)
去那種瘋狂,因爲我已經試過的變種:
location ~ /.well-known {
allow all;
}
location /.well-known/acme-challenge {
default_type text/plain;
}
location /.well-known {
try_files $uri $uri/ =404;
}
沒有運氣。我還檢查了文件夾的權限,甚至設置爲777。我是很新,設置nginx的配置,所以我敢肯定有一個現有條件的投擲它關閉:
server{
listen 80;
server_name domain.com www.domain.com;
location/{
rewrite ^(.*)$ https://domain.com$1 permanent;
}
location ~ /.well-known {
allow all;
}
}
server {
listen 0.0.0.0:443 ssl;
root /var/www/domain.com/public_html;
index index.php index.html index.htm;
server_name domain.com www.domain.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
location/{
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
client_max_body_size 32m;
}
location ~ /.well-known {
allow all;
}
}
你的第一個'server'塊沒有'root'指令。 –
呵呵,謝謝!你可以把它作爲答案嗎? – kilrizzy