| 465 | その他のヴァーチャルホストについては、以下のようなスクリプトを書いて対応…。 |
| 466 | |
| 467 | {{{ |
| 468 | #!console |
| 469 | # vim a.pl |
| 470 | }}} |
| 471 | |
| 472 | {{{ |
| 473 | #!perl |
| 474 | #!/usr/bin/perl |
| 475 | for my $site (@ARGV) { |
| 476 | open my $fh, '>', "$site.conf"; |
| 477 | print $fh <<ENDLINE; |
| 478 | <VirtualHost *:80> |
| 479 | ServerAdmin root\@harapeko.jp |
| 480 | DocumentRoot /var/www/vhosts/$site/html |
| 481 | ServerName $site.harapeko.jp |
| 482 | |
| 483 | IncludeOptional sites-enabled/$site/*.conf |
| 484 | </VirtualHost> |
| 485 | ENDLINE |
| 486 | |
| 487 | mkdir $site, 0755; |
| 488 | } |
| 489 | }}} |
| 490 | |
| 491 | {{{ |
| 492 | #!console |
| 493 | # chmod u+x a.pl |
| 494 | # ./a.pl blog daiyokujo developer test |
| 495 | perl: warning: Setting locale failed. |
| 496 | perl: warning: Please check that your locale settings: |
| 497 | LANGUAGE = "en_US:", |
| 498 | LC_ALL = (unset), |
| 499 | LANG = "ja_JP.UTF-8" |
| 500 | are supported and installed on your system. |
| 501 | perl: warning: Falling back to the standard locale ("C"). |
| 502 | # ls -l |
| 503 | total 36 |
| 504 | lrwxrwxrwx 1 root root 35 May 27 06:36 000-default.conf -> ../sites-available/000-default.conf |
| 505 | -rwxr--r-- 1 root root 328 Aug 10 16:00 a.pl |
| 506 | drwxr-xr-x 2 root root 4096 Aug 10 16:00 blog |
| 507 | -rw-r--r-- 1 root root 189 Aug 10 16:00 blog.conf |
| 508 | drwxr-xr-x 2 root root 4096 Aug 10 16:00 daiyokujo |
| 509 | -rw-r--r-- 1 root root 204 Aug 10 16:00 daiyokujo.conf |
| 510 | drwxr-xr-x 2 root root 4096 Aug 10 16:00 developer |
| 511 | -rw-r--r-- 1 root root 204 Aug 10 16:00 developer.conf |
| 512 | drwxr-xr-x 2 root root 4096 Aug 10 16:00 test |
| 513 | -rw-r--r-- 1 root root 189 Aug 10 16:00 test.conf |
| 514 | # |
| 515 | }}} |