猪小花1号

个人签名

281篇博客

nginx配置系列--新增域名配置示例

猪小花1号2018-09-13 11:16

作者:缪琦


新增域名配置示例

1.模板

路径:

/etc/nginx/nginx.conf目录中->include外置文件路径


sever模板:

server {
server_name 域名;
listen 80;
listen 443 ssl;
ssl_certificate 域名对应的证书路径;
ssl_certificate_key 域名对应的证书key路径;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers '秘钥';
location / {
proxy_pass http://upstream名称;
}
}


upstream模板:

upstream upstream名称 {

    server 服务器IP/名称:部署工程的http端口号;

}

2.示例
路径:
sever:/etc/nginx/sites-available/nginx/haitao
upstream:/etc/nginx/sites-available/nginx/upstream.conf
sever:
server {
server_name min-sp.kaola.com;
listen 80;
listen 443 ssl;
ssl_certificate /etc/nginx/cert/kaola.com.crt;
ssl_certificate_key /etc/nginx/cert/kaola.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS';
location / {
proxy_pass http://minapp;
}
}
upstream:
upstream minapp {
server hzbxs-haitao-test017.server.163.org:5003;
}



本文来自网易实践者社区,经作者缪琦授权发布