The problem of redirecting directory of nginx pan-parsing secondary domain name

server {
  listen 80;
  server_name *.xx.com;
  access_log off;
  index index.html index.htm index.php;
  root /data/wwwroot/www.xx.com;
  if ( $host != "www.xx.com" ) {
     rewrite (.*).xx.com www.xx.com/$1 ;
  }

www.xx.com root directory / data/wwwroot/www.xx.com;
bj.xx.com is to point to / data/wwwroot/www.xx.com/bj

Jun.25,2022

set $subdomain '';
  if ( $host ~* "(?:(\w+\.){0,})(\b(?!www\b)\w+)\.\b(?!(com|org|gov|net|cn)\b)\w+\.\w+" ) { 
    set $subdomain "/$2"; 
  }
  root /data/wwwroot/www.xx.com/$subdomain;

it's perfect

  • Installing selinux makes wordpress inaccessible

    background: my vps installed centos7, to build a wordpress blog through the Lnmp environment. Yesterday, I found that there were a lot of violent login attempts, so I planned to disable port 22. After following this article, I did not succeed in ssh log...

  • Can Nginx represent the directory of another website?

    there is no operation and maintenance in our company for the time being. I have been helping to build and configure nginx. I received a demand today. I think I can t figure it out after reading it on the Internet, right? I would like to ask you: our ...

    May.09,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e6087b-458a8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e6087b-458a8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?