服务器我是买的阿里云的,域名也是在阿里云上买的,注意一点,如今域名必须备案才能用,因此建议先买域名着手备案,等备好案再买服务器。php
粘个阿里云推广的链接,点进去有新人红包
https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=ppef3go2html
若是是我的开发使用,服务器不用买太贵的,1M网速2G内存的就够用了。
域名若是不是商用,也不用太好,我就用的.top,cn和com基本没多少好听的域名了。并且还很贵。nginx
https://freessl.cn/
申请Let's Encrypt的ssl证书web
好比咱们如今要给example.top申请证书安全
配置完成,检测一下
进入检测界面。检测界面这样,可是数据不全,先不用点,还要用刚才那个界面的数据。点击验证
,经过以后会发给你一个压缩包,里边就是证书啦。scp private.key root@112.125.88.123:/root/
,而后要求输入密码,文件就过去了。把两个文件都传过去。/usr/local/nginx/cert/
下了。server { listen 443; ssl on; ssl_certificate /usr/local/nginx/cert/full_chain.pem; ssl_certificate_key /usr/local/nginx/cert/private.key; keepalive_timeout 70; server_name example.top; root /data/webroot/example; charset utf-8; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; fastcgi_param HTTPS on; fastcgi_param HTTP_SCHEME https; location / { index index.php index.html index.htm; if (-e $request_filename) { break; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ .+\.php($|/) { fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } access_log logs/calendar.yimeidan.access.log; error_log logs/calendar.yimeidan.error.log; } server { listen 80; server_name calendar.yimeidan.top; return 301 https://$server_name$request_uri; }
最后的最后,很关键,打开端口!!!打开端口!!!打开端口!!!
阿里云的443端口默认是不打开的,须要以下操做打开端口。(80端口也是须要这么打开的。)
点开你的阿里云控制台,找到你要用的服务器,而后点更多->网络和安全组->安全组配置。
点配置规则,添加安全组规则。添加内容如图。你也能够这样配好80端口。
服务器
理论上完活啦,有问题能够留言交流。
成品截图:
网络
写文不易,若是以为帮到您了,能够支持下。d=====( ̄▽ ̄*)b。
阿里云新人红包:https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=ppef3go2
阿里云产品开年活动:https://www.aliyun.com/acts/product-section-2019/new-users?userCode=ppef3go2
阿里云商标注册服务:https://tm.aliyun.com/?userCode=ppef3go2session