【发布时间】:2018-05-08 12:53:51
【问题描述】:
我是网络服务器领域的新手,我不想让我的网站仅提供 https 服务(适用于 IPV4 和 IPV6),所以我实施了以下步骤,
- 安装letsencrypt。
- 使用 Nginx 插件安装 certbot。
- 使用命令创建证书,
sudo certbot --nginx certonly -d maarath.com -d www.maarath.com
4.在 etc/nginx/site-available/main 中手动配置我的站点配置文件,如下所示,
server {
listen 80 ;
listen [::]:80 ;
root /var/www/main/;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name maarath.com www.maarath.com;
location / {
try_files $uri $uri/ =404;
}
# HTTPS
listen 443 ssl;
server_name maarath.com www.maarath.com;
ssl_certificate /etc/letsencrypt/live/maarath.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/maarath.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
#deny access to .htaccess files, if Apache's document root
#concurs with nginx's one
location ~ /\.ht {
}
}
- 运行命令 nginx -t 没有问题。
- 重启 nginx。
问题是我的网站在完成上述所有步骤后仍然不安全,是我遗漏了什么还是做错了什么?任何帮助将不胜感激。
【问题讨论】:
-
也许你可以将80端口重定向到443
标签: nginx lets-encrypt