nginx配置的问题

来源:1-8 配置 Nginx 端口代理与域名指向

qq_军莅九州_00__11

2017-07-12

请问能不能提供一份nginx的配置文件的代码作为参考呢

写回答

2回答

Scott

2017-07-12

conf.d 是一个文件夹目录


nginx.conf 里面有一行配置项,指定了,要从 conf.d 下面加载它里面所有的符合规则的配置文件。


我的配置文件是这样的,有植入 SSL 证书,不过我还会对 SSL 证书集成做一些更多的配置项,先参考这个吧



upstream iceandfire {
  server 127.0.0.1:3005;
}
server {
  listen 80;
  server_name iceandfire.iblack7.com;
  #rewrite ^(.*) https://$host$1 permanent;
  return 301 https://iceandfire.iblack7.com$request_uri;
}
server {
  listen 443;
  server_name iceandfire.iblack7.com; #填写绑定证书的域名
  ssl on;
  ssl_certificate /www/ssl/1_iceandfire.iblack7.com_bundle.crt;
  ssl_certificate_key /www/ssl/2_iceandfire.iblack7.com.key;
  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
  ssl_prefer_server_ciphers on;
  if ($ssl_protocol = "") {
    rewrite ^(.*) https://$host$1 permanent;
  }
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Nginx-Proxy true;
    proxy_pass http://iceandfire;
    proxy_redirect off;
  }
  location ~* ^.+\.(txt) {
    root /www/icefire/public;
  }
}


0
0

qq_军莅九州_00__11

提问者

2017-07-12

还有 nginx.conf的配置和conf.d的配置是什么关系呢

0
0

开发微信全家桶项目Vue/Node/MongoDB高级技术栈全覆盖

Nuxt/Vue SSR + Koa2 跨栈开发微信公众号+小程序

989 学习 · 401 问题

查看课程