启动一个服务——systemctl start nginx.service
关闭一个服务——systemctl stop nginx.service
重启一个服务:——systemctl restart nginx.service
步骤
连接后linux后
进入目录 cd /data/ssl
新建 一个 目录 mkdir xxxx
进入目录 cd xxxx
上传文件 rz (弹出窗口 选择即可)
cd /etc/nginx/conf.d
cp 443.conf.bak xxxx.conf 复制一份模板
(80复制80.conf.bak)
(443复制443.conf.bak)
vim xxx.conf
按键盘的(i)
然后修改参数
完成后 按ESC 在按ctrl+: 输入wq 回车(保存) (q! 不保存)
重启 systemctl restart nginx.service
重启失败 systemctl status nginx.service 查看原因
443.conf.bak
server {
listen 80;
listen 443 ssl;
server_name www.www.com.cn;
ssl_certificate op14/1_www.xxx.com.cn_bundle.crt;
ssl_certificate_key op14/2_www.xxx.com.cn.key;
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;
location / {
#root html;
#index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.1.11:8000;
}
}
80.conf.bak
server {
listen 80;
server_name www.xxx.cn;
location / {
proxy_pass http://222.2222.222.222:2222;
}
}