Browse Source

:bug: fix '_' in domain

Jeremy Zheng 3 years ago
parent
commit
053a2ddb41
2 changed files with 3 additions and 2 deletions
  1. 1 1
      documents/development/SPRING.md
  2. 2 1
      scripts/spring/user.sh

+ 1 - 1
documents/development/SPRING.md

@@ -8,7 +8,7 @@ ssh -i YOUR_KEY YOUR_ID@YOUR_ID.spring.wikipali.org
 
 ## PHP 开发(以用户 xxx 为例)
 
-- `~/www/htdocs/info.php` => `https://YOUR_ID.spring.wikipali.org/info.php`
+- `~/www/htdocs/info.php` => `https://YOUR_ID.spring.wikipali.org/info.php` (**如果您的 id 里面有'\_',需要替换成'-'**)
 - 日志文件在 `~/www/logs/`
 - 其余参见[常见 PHP 设置](php/)
 

+ 2 - 1
scripts/spring/user.sh

@@ -38,12 +38,13 @@ fi
 
 if [ ! -f /workspace/www/$1/nginx.conf ]
 then
+    # https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
     cat > /workspace/www/$1/nginx.conf <<EOF
 server {
   listen 80;
   root /workspace/www/$1/htdocs;
   index index.html index.php;
-  server_name $1.spring.wikipali.org;
+  server_name ${1//_/-}.spring.wikipali.org;
 
   access_log /workspace/www/$1/logs/access.org;
   error_log /workspace/www/$1/logs/error.log;