https不能在nginx和apache ubuntu上工作

我正在使用端口81的nginx和端口80的apache运行。我尝试把SSL证书放在nginx中。 这不是在开玩笑。

这是我的nginx的默认值:

server{ listen 81; listen 443 ssl; server_name 35.154.225.46; ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; location / { proxy_pass http://localhost:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } 

我按照以下教程创build了SSL证书 : 如何在Nginx上为Ubuntu 14.04创buildSSL证书

编辑:之前我试图使用SSL。 我在端口81上使用nginx [node js],在端口80上使用apache [php]。现在我试着在nginx中使用SSL。 现在Nginx正在使用ssl默认端口[80],Apache不工作。 我想两个服务器应该运行。

您为sslconfiguration了端口441。 端口81仍然configuration为使用http。 如果您尝试使用https连接到端口81,则会出现协议错误,因为服务器会使用纯http,但客户端需要ssl响应。

如果要在端口81上使用ssl,则必须添加ssl关键字。

 listen 81 ssl;