I configured an nginx server block. And I'm still stack on one last thing. I want the www.domain.com to point at a specific directory (root /var/www/directory1) and all the other subdomains (eg sub1.domain.com, etc, execpt the www) to point at an other directory (root /var/www/directory2). How do you do that ? Rewrite or proxy pass?
Thank you
You can use a default server block to match all of your domains with the exception of www.example.com
. For example:
server {
listen 80 default_server;
root /var/www/directory2;
...
}
server {
listen 80;
server_name www.example.com;
root /var/www/directory1;
...
}
See this document for details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.