我正在尝试在我的服务器上安装一个positivessl证书,但没有成功。 我开始在我的服务器上创build一个mydomain.key文件并请求证书。 我使用捆绑的文件
cat www_***_co_uk.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
我把这个file upload到我的服务器到home/piet目录。 这也是我的.key和.csr的地方。 现在我需要更新nginxconfiguration,对吧? 我正在使用从数字海洋的Drupal液滴安装。 在我的/etc/nginx/sites-enabled有
drwxr-xr-x 2 root root 4096 Apr 22 07:38 . drwxr-xr-x 5 root root 4096 Nov 25 18:45 .. -rw-r--r-- 1 root root 16 Apr 22 07:38 default lrwxrwxrwx 1 root root 33 Nov 25 18:45 drupal -> /etc/nginx/sites-available/drupal
这里的默认文件是空的,所以我跟着链接。 在/etc/nginx/sites-available我有
drwxr-xr-x 2 root root 4096 Nov 25 18:45 . drwxr-xr-x 5 root root 4096 Nov 25 18:45 .. -rw-r--r-- 1 root root 2709 Apr 22 07:49 default -rw-r--r-- 1 root root 1607 Apr 22 08:08 drupal
我编辑的Drupal文件
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; rewrite ^/(.*) https://www.***.co.uk/$1 permanent; root /var/www/html/drupal; index index.php index.html index.htm; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ \..*/.*\.php$ { return 403; } location ~ ^/sites/.*/private/ { return 403; } location ~ (^|/)\. { return 403; } location / { try_files $uri @rewrite; } location @rewrite { rewrite ^ /index.php; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php5-fpm.sock; } location ~ ^/sites/.*/files/styles/ { try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } } server { listen 443; server_name www.***.co.uk; root /var/www/html/drupal; index index.php index.html index.htm; ssl on; ssl_certificate /home/piet/ssl-bundle.crt; ssl_certificate_key /home/piet/www.***.co.uk.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; ssl_prefer_server_ciphers on; }
但它似乎仍然没有工作。 事实上,我预计至less将http://网站redirect到https://但即便如此,情况并非如此。 每次编辑后我都重新启动了nginx。 我究竟做错了什么?
所有的位置块需要在https服务器块中,因为这是处理您的请求。 需要在http服务器部分的唯一逻辑是执行redirect所需的。
编辑:现在我们有问题的主机名,我可以看到您的服务器上的端口443已closures:
$ nmap www.boilerplaza.co.uk -p 443 Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-22 09:12 CDT Nmap scan report for www.boilerplaza.co.uk (46.101.22.233) Host is up (0.10s latency). PORT STATE SERVICE 443/tcp closed https Nmap done: 1 IP address (1 host up) scanned in 0.36 seconds
也许你需要在防火墙中打开这个端口。