在nginx上托管多人网站

时间:2016-09-18 14:11:21

标签: nginx cname

目前我的nginx.conf看起来像这样:

server {
  listen   80; ## listen for ipv4; this line is default and implied
  listen   [::]:80 default ipv6only=on; ## listen for ipv6

  root /usr/share/nginx/html;
  index index.html index.htm;

  # redirect server error pages to the static page /50x.html
  #
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root /usr/share/nginx/html;
  }

  # Attempt to load static files, if not found route to @rootfiles
  location ~ (.+)\.(html|json|txt|js|css|jpg|jpeg|gif|png|svg|ico|eot|otf|woff|woff2|ttf)$ {
    try_files $uri @rootfiles;
  }

  # deny access to . files, for security
  #
  location ~ /\. {
    access_log off;
    log_not_found off;
    deny all;
  }

  location @rootfiles {
     rewrite ^/(?:triangles|equation-of-a-line)/(.*) /$1 redirect;
  }

  sendfile off;
}

我基本上在root /usr/share/nginx/html;有一个网站。

如何更改此设置以允许多个站点将每个站点托管在同一根目录中?

另外,我将cname *映射到IP地址。

如何更改此设置,以便每个网站都有自己的cname?

0 个答案:

没有答案
相关问题