複製メモ

DBが無いのでフォルダをコピーするだけです。

開発環境用にコピー

root@gce-free:~# cp -rip /var/www/{,dev.}frzl.net

cacheを削除

root@gce-free:~# cd /var/www/dev.frzl.net/public/
root@gce-free:/var/www/dev.frzl.net/public# ./bin/grav clearcache --all

Clearing cache

Cleared:  /var/www/dev.frzl.net/public/cache/*
Cleared:  /var/www/dev.frzl.net/public/images/*
Cleared:  /var/www/dev.frzl.net/public/assets/*
Cleared:  /var/www/dev.frzl.net/public/tmp/*

Touched: /var/www/dev.frzl.net/public/user/config/system.yaml

root@gce-free:/var/www/dev.frzl.net/public# ls -la cache/
total 32
drwxr-xr-x  7 www-data www-data 4096 Jan 31 13:31 .
drwxr-xr-x 15 www-data www-data 4096 Jan 17 19:51 ..
-rw-r--r--  1 www-data www-data   84 Nov 12 00:31 .gitkeep
drwxr-xr-x  2 www-data www-data 4096 Jan 31 13:31 compiled
drwxr-xr-x  2 www-data www-data 4096 Jan 31 13:31 doctrine
drwxr-xr-x  2 www-data www-data 4096 Jan 31 13:31 gpm
drwxr-xr-x  2 www-data www-data 4096 Jan 31 13:31 login
drwxr-xr-x  2 www-data www-data 4096 Jan 31 13:31 twig
root@gce-free:/var/www/dev.frzl.net/public# cd ~
root@gce-free:~# 

VH設定

root@gce-free:~# pushd /etc/apache2/sites-enabled/
/etc/apache2/sites-enabled ~
root@gce-free:/etc/apache2/sites-enabled# ls -la
total 20
drwxr-xr-x 4 root root 4096 Jan  3 14:14 .
drwxr-xr-x 8 root root 4096 Jan 11 06:53 ..
drwxr-xr-x 2 root root 4096 Jan  3 01:06 .backup
lrwxrwxrwx 1 root root   35 Aug 28 22:20 000-default.conf -> ../sites-available/000-default.conf
-rw-r--r-- 1 root root  454 Jan  3 14:14 001-frzl.net.conf
drwxr-xr-x 2 root root 4096 Sep 28 20:57 bk
root@gce-free:/etc/apache2/sites-enabled# sed -e "s/frzl.net/dev.frzl.net/g" 001-frzl.net.conf > 002-dev.frzl.net.conf

basic-auth追加

root@gce-free:/etc/apache2/sites-enabled# vi 002-dev.frzl.net.conf
  <Directory "/var/www/dev.frzl.net/public">
      AllowOverride All
      AuthType Basic
      AuthUserFile /var/www/dev.frzl.net/.htpasswd
      AuthName "basic-auth"
      require valid-user
  </Directory>
root@gce-free:~# htpasswd -c /var/www/dev.frzl.net/.htpasswd ユーザー名

basic_module確認

digest認証しかなかったのでbasic認証も有効にする

root@gce-free:~# apache2ctl -M|grep basic
root@gce-free:~# apache2ctl -M|grep digest
 auth_digest_module (shared)

root@gce-free:~# a2enmod auth_basic
Considering dependency authn_core for auth_basic:
Module authn_core already enabled
Enabling module auth_basic.
To activate the new configuration, you need to run:
  systemctl restart apache2
root@gce-free:~# apache2ctl -M|grep basic
 auth_basic_module (shared)
root@gce-free:~# apache2ctl graceful

configtest

root@gce-free:/etc/apache2/sites-enabled# apache2ctl -tS

graceful

root@gce-free:/etc/apache2/sites-enabled# apache2ctl graceful
root@gce-free:/etc/apache2/sites-enabled# ps awxu|grep apa
root      159219  0.0  3.3 269032 32836 ?        Ss   Jan11   1:37 /usr/sbin/apache2 -k start
www-data 2225196  0.0  0.8  89532  8832 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
www-data 2225197  0.0  1.0 269104 10496 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
www-data 2225198  0.0  1.0 269104 10496 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
www-data 2225199  0.0  1.0 269104 10496 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
www-data 2225200  0.0  1.0 269104 10496 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
www-data 2225201  0.0  1.0 269104 10496 ?        S    13:29   0:00 /usr/sbin/apache2 -k start
root     2225204  0.0  0.1   3752  1700 pts/0    S+   13:29   0:00 grep apa

前の記事 次の記事