ブログ - Raspbian 9.4上のApache2で最小限設定でWebサーバを設定
apache2からはsites-availableディレクトリにファイルを設置する.現在状態を確認.
次のような設定ファイルを作成.
設定ファイルを有効にするために,sites-enabledディレクトリを確認.
リンクを設置.
リンクが作られたか確認.
不要なリンクを削除.
設定が終わったら,Apache2の再起動を行う.
これで,/www/ipaccess/htmlに配置したコンテンツをみることができるようになったはずです.
root@raspberrypi:/etc/apache2/sites-available# ls -la🆑
合計 28
drwxr-xr-x 2 root root 4096 9月 5 22:44 .
drwxr-xr-x 8 root root 4096 9月 2 23:11 ..
-rw-r--r-- 1 root root 1332 9月 20 2017 000-default.conf
-rw-r--r-- 1 root root 6338 4月 6 03:32 default-ssl.conf
root@raspberrypi:/etc/apache2/sites-available#
root@raspberrypi:/etc/apache2/sites-available# cat ipaccess.conf🆑
<VirtualHost *:80>
ServerName 192.168.20.241
ServerAdmin webmaster@localhost
DocumentRoot /www/ipaccess/html
ErrorLog /www/logs/ipaccess/error.log
CustomLog /www/logs/ipaccess/access.log combined
DirectoryIndex "index.php" "index.html"
<Directory "/www/ipaccess/html">
Require all granted
</Directory>
</VirtualHost>
root@raspberrypi:/etc/apache2/sites-available#
root@raspberrypi:/etc/apache2/sites-available# cd ../sites-enabled/🆑
root@raspberrypi:/etc/apache2/sites-enabled# ls -la🆑
合計 8
drwxr-xr-x 2 root root 4096 9月 2 01:26 .
drwxr-xr-x 8 root root 4096 9月 2 23:11 ..
lrwxrwxrwx 1 root root 35 9月 2 01:26 000-default.conf -> ../sites-available/000-default.conf🈁
root@raspberrypi:/etc/apache2/sites-enabled#
root@raspberrypi:/etc/apache2/sites-enabled# ln -s ../sites-available/ipaccess.conf 001-ipaccess.conf🆑
root@raspberrypi:/etc/apache2/sites-enabled#
root@raspberrypi:/etc/apache2/sites-enabled# ls -la🆑
合計 8
drwxr-xr-x 2 root root 4096 9月 5 23:00 .
drwxr-xr-x 8 root root 4096 9月 2 23:11 ..
lrwxrwxrwx 1 root root 35 9月 2 01:26 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 32 9月 5 23:00 001-ipaccess.conf -> ../sites-available/ipaccess.conf🈁
root@raspberrypi:/etc/apache2/sites-enabled#
root@raspberrypi:/etc/apache2/sites-enabled# rm 000-default.conf🆑
root@raspberrypi:/etc/apache2/sites-enabled# ls -la🆑
合計 8
drwxr-xr-x 2 root root 4096 9月 5 23:02 .
drwxr-xr-x 8 root root 4096 9月 2 23:11 ..
lrwxrwxrwx 1 root root 32 9月 5 23:00 001-ipaccess.conf -> ../sites-available/ipaccess.conf🈁
root@raspberrypi:/etc/apache2/sites-enabled#
root@raspberrypi:/etc/apache2/sites-enabled# service apache2 stop🆑
root@raspberrypi:/etc/apache2/sites-enabled# service apache2 start🆑
root@raspberrypi:/etc/apache2/sites-enabled#