端口443在Nginx + Ubuntu + EC2上设置SSL

我已经尝试了所有的东西,并且search了Google的一些解决scheme,但是不能在我的Nginx服务器中configurationSSL(https),它位于Amazon EC2上的Ubuntu 14.04.2 LTS中。 我的网站使用HTTP完全在80端口上工作,但是我会使用HTTPS更安全。

注意事项:

  1. 每当我尝试通过https://访问它https://给出错误: ERR_CONNECTION_TIMED_OUT

  2. 命令curl -v https://www.mywebsite.com/返回: curl: (7) Failed to connect to www.mywebsite.com port 443: Connection timed out

  3. 命令nc -vz localhost 443返回: Connection to localhost 443 port [tcp/https] succeeded!

  4. 命令nc -vz myserverIP 443返回:nc:连接到myserverIP端口443(tcp)失败:连接超时

  5. 用于HTTPS的TCP 443端口在入站和出站时在安全组(Amazon EC2防火墙)上的任何位置打开。

  6. `netstat -ntlp | grep LISTEN:

    tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1244 / proftpd 🙁 acce tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1130 / sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 5633 / nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5633 / nginx tcp6 0 0 ::: 22 ::: * LISTEN 1130 / sshd tcp6 0 0 ::: 443 ::: * LISTEN 5633 / nginx tcp6 0 0 ::: 80 ::: * LISTEN 5633 / nginx

Nginxconfiguration:

  1. nginx.conf: http : //pastebin.com/ebSaqabh

  2. ssl.conf (通过在nginx.conf包含conf.d调用): http : //pastebin.com/FzVAtjGz

  3. sites-available/default

    server {listen 80 default_server; 听[::]:80 default_server ipv6only = on; charset utf-8; 根/ usr / share / nginx / html; index index.php index.html index.htm;

     server_name mywebsite.com www.mywebsite.com; #return 301 https://mywebsite.com$request_uri; #rewrite ^(.*) https://www.mywebsite.com$1 permanent; location / { #try_files $uri $uri/ =404; try_files $uri $uri/ /index.php?q=$uri&$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_read_timeout 300; } #include /etc/nginx/common/w3tc.conf; include /etc/nginx/common/wordpress-seo-plugin-support.conf; 

    }

我不知道还有什么办法来解决这个问题。 有人可以帮助我吗? 你的Nginxconfiguration有问题吗? 还是需要改变亚马逊的其他任何东西?

噢,我的…… 🙁 Ubuntu防火墙(UFW)被激活(noob)。我添加了ufw allow 443/tcp ,现在没事了,对于这个post感到抱歉,但是谁用nginx和php-fpm搭载web服务器享受上述设置都是正确的,我的网站现在正常运行也与https。