Debian StretchをインストールしたNUCに、LEMP環境を構築したいと思います。
Debian Stretch LEMPスタック構築手順
Debian Stretchのインストール
Debian Stretchのインストール手順はこちらの記事になります。
Nginxインストール
- suコマンドで管理権限でシェルを実行します。
- aptでnginxをインストールします。
apt install nginxインストール後、サービスは自動起動するようです。
- Webブラウザでアクセス可能かどうか確認します。
http://<PCのIPアドレス>
MariaDBインストール
- aptでMariaDBをインストールします。
apt install mariadb-server - 初期設定を行います。
mysql_secure_installation - mysqlコマンドで動作を確認してみました。
mysql -u root -p
PHPインストール
- PHPをインストールします。
apt install php-fpm php-mysql - nginxの設定を変更します。/etc/nginx/sites-available/defaultを編集します。
#index index.html index.htm index.nginx-debian.html; index index.php index.html index.htm index.nginx-debian.html; # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; }44行目付近のindex行にindex.phpを追加、56行目location ~ \.php$ セクションのinclude行とfastcgi_pass行をアンコメントして有効にします。

- nginxを再起動します。
systemctl restart nginx.service - 動作確認のためphpinfo.phpを作成します。
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php - ブラウザでアクセスしてphpの動作を確認します。
http://<PCのIPアドレス>/phpinfo.php
phpinfoを確認したところ、phpとMariaDBとの連携も大丈夫そうです。
以上でLEMP環境が構築できました。
さて、どんなサーバアプリケーションを入れましょうか?



コメントを残す