我有Web服务器与Apache2与许多子域上它像domain.com,abc.domain.com,def.domain.com等现在我有一个新的nginx服务器,并希望像apache2设置它,所以testing我创build了configs(/ etc / nginx / sites-available /中的2个文件,并从站点启用/链接到它们),如图所示,
domain.config:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /srv/www/; index index.html index.htm; # Make site accessible from http://localhost/ server_name domain.com; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } }
abc-domainconfiguration:
server { listen 80; listen [::]:80; root /srv/www/tmp1/; index index.html index.htm; # Make site accessible from http://localhost/ server_name abc.domain.com; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } }
但是当我访问domain.com时,我只能从/ var / www / tmp1获取index.html。 有没有什么我在做nginxconfiguration错了?