由于高清崩溃而导致重新安装后,我的重定向已停止工作。为什么?我可以看到的唯一区别是根目录从var / www更改为var / www / html。我尝试将/ var / www指定为根目录,并将/ var / www /指定为目录。如果我关闭ssl,则我的默认conf具有相同的指令,我会遇到相同的问题。
我正在使用ssl并且我的000-default-le-ssl.conf包含
ServerAdmin webmaster@localhost
DocumentRoot / var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.yellowrockonline.com.au [OR]
RewriteCond %{SERVER_NAME} =yellowrockonline.com.au
RewriteRule ^(wiki)$ https://www.yellowrockonline.com.au/cgi-bin/mywikicgi
RewriteRule ^(view/.*)$ http://localhost:8080/$1 [P,L]
RewriteRule ^(edit/.*)$ http://localhost:8080/$1 [P,L]
RewriteRule ^(save/.*)$ http://localhost:8080/$1 [P,L]
</Directory>
# Redirect "/view/suggestion" http://localhost:8080/view/suggestion
# works but returns localhost:8080/ to the browser
The cgi program starts from a link to www.domainname/cgi-bin/programname and returns domainma,e/view/suggestion to the browser along with the error
在此服务器上找不到请求的URL。
网址为www.yellowrockonline.com.au的Apache / 2.4.38(Debian)服务器端口443
CGI程序https://www.yellowrockonline.com.au/cgi-bin/mywikicgi的链接
传递更改的网址的go代码
func hello(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/view/suggestion", http.StatusFound)
// added to do redirect
fmt.Fprintf(w, "Hello from Go! Redirecting to suggestions")
}
func main() {
http.HandleFunc("/view/", makeHandler(viewHandler))
http.HandleFunc("/edit/", makeHandler(editHandler))
http.HandleFunc("/save/", makeHandler(saveHandler))
http.HandleFunc("/", hello)
cgi.Serve(nil)
log.Fatal(http.ListenAndServe(":8080", nil))
}
最佳答案
试图找出我的旧配置和新配置之间的区别。我终于想起了第一次尝试这样做的过程,我尝试使用proxypass而不是重写规则。
一旦启用proxypass,问题便自动修复了。虽然为什么会这样,但我不知道我没有使用代理通过,并且重写不应该依赖于它。
sudo a2enmod代理&& sudo a2enmod代理_http
你猜怎么了!它解决了问题,现在可以工作了!我又开心了!
我添加了一个额外的重定向,以阻止人们看到正在运行的cgi程序的名称。
关于apache - debian上的golang/apache/cgi-apache重定向停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60181505/