小编Que*_*sen的帖子

Golang SSL TCP套接字证书配置

我正在创建一个Go TCP服务器(不是http/s),我正在尝试将其配置为使用SSL.我有一个StartCom免费的SSL证书,我试图用来完成这个.我的服务器代码如下所示:

    cert, err := tls.LoadX509KeyPair("example.com.pem", "example.com.key")
    if err != nil {
        fmt.Println("Error loading certificate. ",err)
    }
    trustCert, err := ioutil.ReadFile("sub.class1.server.ca.pem")
    if err != nil {
        fmt.Println("Error loading trust certificate. ",err)
    }
    validationCert, err := ioutil.ReadFile("ca.pem")
    if err != nil {
        fmt.Println("Error loading validation certificate. ",err)
    }
    certs := x509.NewCertPool()
    if !certs.AppendCertsFromPEM(validationCert) {
        fmt.Println("Error installing validation certificate.")
    }
    if !certs.AppendCertsFromPEM(trustCert) {
        fmt.Println("Error installing trust certificate.")
    }

    sslConfig := tls.Config{RootCAs: certs,Certificates: []tls.Certificate{cert}}

    service := ":5555"
    tcpAddr, error := net.ResolveTCPAddr("tcp", service)
    if …
Run Code Online (Sandbox Code Playgroud)

ssl tcp go

7
推荐指数
1
解决办法
5183
查看次数

Apache忽略了mime-type

我有一个页面使用JWPlayer以各种格式选择(mp4,m4v,ogv,webm)提供视频.但是,当从Firefox(23.0.1)或PHP curl访问页面时,Apache返回一个表示content-typeas 的标题text/plain.Firefox(以及较新的IE版本,除非在兼容模式下)不会播放视频.我曾试图加入MIME类型mime.types,httpd.conf和在.htaccess目录中的文件.

mime.types

video/mp4   mp4 m4v
video/ogg   ogv
video/webm  webm
Run Code Online (Sandbox Code Playgroud)

httpd.conf

AddType video/mp4 mp4 m4v
AddType video/ogg ogv
AddType video/webm webm
Run Code Online (Sandbox Code Playgroud)

.htaccess

AddType video/mp4 mp4 m4v
AddType video/ogg ogv
AddType video/webm webm
Run Code Online (Sandbox Code Playgroud)

我已尝试在扩展前面使用和不使用点(我理解应该以任何方式工作).我重新启动了Apache.我已经验证我正在编辑正确的配置文件.Apache继续返回该text/plain类型.我哪里出错了?

更新:按照rekire in ,virtualhost和.的建议尝试FilesMatchForceType指示.在中间人缓存的情况下尝试重命名文件和更改链接以匹配.直接进入URL下载视频,并允许在桌面播放器中正常播放.httpd.conf.htaccess

apache video jwplayer mime-types

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

apache ×1

go ×1

jwplayer ×1

mime-types ×1

ssl ×1

tcp ×1

video ×1