UJP - Raspbian 9.4上のApache2で最小限設定でWebサーバを設定

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

ブログ - Raspbian 9.4上のApache2で最小限設定でWebサーバを設定

Raspbian 9.4上のApache2で最小限設定でWebサーバを設定

カテゴリ : 
PC » Raspberry Pi
ブロガー : 
ujpblog 2018/9/6 0:58
 apache2からはsites-availableディレクトリにファイルを設置する.現在状態を確認.
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#
 設定ファイルを有効にするために,sites-enabledディレクトリを確認.
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#
 設定が終わったら,Apache2の再起動を行う.
root@raspberrypi:/etc/apache2/sites-enabled# service apache2 stop🆑
root@raspberrypi:/etc/apache2/sites-enabled# service apache2 start🆑
root@raspberrypi:/etc/apache2/sites-enabled#
 これで,/www/ipaccess/htmlに配置したコンテンツをみることができるようになったはずです.

トラックバック


広告スペース
Google