環境1
1 2 3 4 5 6 |
Linux PCName 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble |
環境2
1 2 3 4 5 6 |
Linux PCName 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm |
Install Web Server
1 2 |
$ sudo apt install tasksel $ sudo tasksel |
– Select Web Server
Install Database
1 2 |
$ sudo apt-get install mariadb-server mariadb-client $ sudo mysql_secure_installation |
Install PHP
1 |
$ sudo apt install php libapache2-mod-php php-mysql |
1 2 3 4 5 6 7 8 9 10 11 |
cd /etc/apache2/mods-enabled ln -s ../mods-available/userdir.conf . ln -s ../mods-available/userdir.load . ln -s ../mods-available/rewrite.load . ln -s ../mods-available/deflate.* . ln -s ../mods-available/expires.load . ln -s ../mods-available/headers.load . ln -s ../mods-available/cgi* . ln -s ../mods-available/rewrite.load . |
– リンクの作成に失敗するものもあるが問題ない
– Debian は php version 8.2
1 2 |
$ cd /etc/apache2/mods-enabled $ sudo vi php8.3.conf |
1 2 |
# php_admin_flag engine Off php_admin_flag engine On |
1 2 |
$ cd /etc/php/8.3/apache2/ $ sudo vi php.ini |
1 2 |
;display_errors = Off display_errors = On |
1 2 |
;error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT error_reporting = E_ALL |
Installing modules and more
1 2 |
$ sudo apt install php-mbstring $ sudo apt install phpmyadmin |
Restart
1 |
$ sudo /etc/init.d/apache2 restart |
ユーザーアドレスにアクセスするとエラーになったので、
– http://localhost/~USERNAME/
1 2 3 4 |
Forbidden You don't have permission to access this resource. Apache/2.4.58 (Ubuntu) Server at localhost Port 80 |
– before: /home/USERNAME/ rwxr-x— 750
– after: /home/USERNAME/ rwxr-x–x 751