1
我在Nginx
上使用类似下面的内容作为“默认”vhost
。我希望每个子域都有一个自己的目录。Nginx通配符根子域的后备
任何人都可以帮助一个后备(我是新来的)。如果目录/子域不存在,我想要某种自定义404.html
页面。
谢谢!
server {
server_name ~^(.+).mysite.com$;
set $root_path $1;
root /var/www/$root_path/public;
index index.html index.php;
location/{
try_files $uri /$uri /index.php?$args;
}
location ~ \.php$ {
#Include Nginx’s fastcgi configuration
include /etc/nginx/fastcgi.conf;
#Look for the FastCGI Process Manager at this location
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
client_max_body_size 100m;
}
}