操作系统:Ubuntu 20
更新apt-get (已更新的就不用了)
apt-get update
nginx 安装
apt-get install nginx
查看nginx是否安装成功
nginx -v
停止
service nginx stop
启动
service nginx start
重启
service nginx restart
查看状态
service nginx status
检查nginx配置文件
nginx -t
使配置生效
nginx -s reload
配置 ssl 证书
nginx默认安装路径
/etc/nginx
在nginx.conf配置
http
{
server {
listen 443 ssl;
server_name jobs8.cn; #域名
#ssl on;
ssl_certificate /etc/letsencrypt/live/jobs8.cn/fullchain.pem; #证书路径
ssl_certificate_key /etc/letsencrypt/live/jobs8.cn/privkey.pem; #证书路径
ssl_session_cache shared:SSL:1m;
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;
}
}