对我来说nginx就是两个作用,(1)当个WEB服务器用(2)给其它WEB应用走https
docker pull nginx
docker run -it -d --name mynginx --privileged --net=host nginx
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 443 ssl;
server_name 13ua.com;
ssl on;
ssl_certificate /usr/share/nginx/html/13
自架设了leanote,其中邮箱配置一直不成功,去官群问了一下,只得到了一个莫明的提示:“和ssl”有关。也没说清是邮箱ssl还是leanote网站https需要的那个ssl。
好吧得不到更详细的答案那就自己搞
修改app.conf
http.ssl = false 改为true
#添加以下两行,path改成你存放证书的地址
http.sslcert=/path/domain.crt
http.sslkey=/path/domain.key
http.sslcert=/path/domain.pem
http.sslkey=/path/domain.key
#其中8889改成你的app.conf中一样的端口
httpRedirectServer := &http.Server{Addr: ":8899", Handler: http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, fmt.Sprintf("https://%s%s", r.Host, r.RequestURI),
http.StatusMovedPermanently)
})}
go httpRedirectServer.ListenAndServe()
邮箱问题依旧