我剛剛在tps(https://gogs.io/docs/installation/install_from_source)的幫助下在VPS上安裝了Gogs。 我有一個子域,以達到我的gogs實例:git.mydomainname.com,它的工作原理:http://git.mydomainname.com去我的gogs實例與反向代理。使用Nginx for Gogs在Debian 9中啓用Letsencrypt
我希望通過SSL保護我的gogs,因此我想使用以下tuto安裝LetsEncrypt(https://certbot.eff.org/#debianstretch-nginx)。
我想說我是系統管理的新手,並不一定了解我在Gogs安裝過程中所做的一切。 我也是Nginx的新手(更習慣於Apache)。
這裏是我遵循的過程:
$ sudo certbot certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
-------------------------------------------------------------------------------
1: Place files in webroot directory (webroot)
2: Spin up a temporary webserver (standalone)
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel):git.mydomainname.com
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for git.mydomainname.com
Select the webroot for git.mydomainname.com:
-------------------------------------------------------------------------------
1: Enter a new webroot
-------------------------------------------------------------------------------
Press 1 [enter] to confirm the selection (press 'c' to cancel): /home/git/go/src/github.com/gogits/gogs
** Invalid input **
Press 1 [enter] to confirm the selection (press 'c' to cancel): 1
Input the webroot for git.mydomainname.com: (Enter 'c' to cancel):/home/git/go/src/github.com/gogits/gogs
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. git.mydomainname.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://git.mydomainname.com/.well-known/acme-challenge/N4rMGzoq1Bwyt9MP9fUlVY3_mDnJfRYpQkdvc7WrNJs: "<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: git.mydomainname.com
Type: unauthorized
Detail: Invalid response from
http://git.mydomainname.com/.well-known/acme-challenge/N4rMGzoq1Bwyt9MP9fUlVY3_mDnJfRYpQkdvc7WrNJs:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
所以我檢查了錯誤,DNS記錄是OK。 我還發現法語(https://www.grafikart.fr/formations/serveur-linux/nginx-ssl-letsencrypt)的另一個tuto幫助我,我注意到我不得不更新我的網站nginx配置,儘管我有一個反向代理(也許問題在這裏)。
server {
listen 80;
server_name git.mydomainname.com
location ~ /\.well-known/acme-challenge {
allow all;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location/{
proxy_pass http://localhost:port_number;
}
}
感謝您的幫助。
嘗試'2:啓動一個臨時webserver(獨立)'而不是webroot。 – tkausl