自宅サーバをXamppのApache、MySQL、MercuryMail、FileZillaで構築

Xamppのインストールと基本設定に関しての参考になる情報は検索でいくらでも探せるけど、実際に運用する自宅サーバにはセキュリティ対策を含た準備が必要になる。取り合えず以前ローカル環境でXamppをインストールした時のデータを基に立ち上げた。

ApacheとPHP
MariaDB(MySQL)とphpMyAdmin
MercuryMailとFileZilla FTP Server

ダウンロードしたXamppをインストールしてXAMPP ControlPanelを管理者権限でオープン、各Module(Apache,MySQL,FileZilla,Mercury)が正常にスタートするのを確認。又、ApacheのAdminでDashboadを開きphpMyAdminやPHPの確認。各モジュールのインフォメーションなどもチェックして機能的なことなど知る。

次に、Xampp ControlPanelに戻り右側にある「shell」をクリックしてXamppのコマンドプロンプトを開き、MySQLの設定を行う。ネット上には沢山の情報があるので、詳しく記事にするより先ずは準備が出来た段階から各サーバの設定をメモ的に記事にする予定。

Windows版のCerbotによる「Apache+Let’s Encrypt」でSSL化する(マルチドメイン対応)

Let’s EncryptでwebサーバーをSSL化して自動更新までさせるといった情報はサイトで多数みつける事ができるけど、ダイナミックDNSでの作業が面倒で何度も失敗したりでGive-up寸前のところで見つけた情報が「Windows版CerbotでSSL化」、早速試したところ超簡単15分程度でLetsencrypt証明書を取得できた。

-Let’s Encrypt-

Certbot – Windows Apache】
Automatically enable HTTPS on your website with EFF’s Certbot, deploying Let’s Encrypt certificates.

① Letsencryptの証明書取得準備

WordPressのインストールが終了した後、直ちに「Windows版Cerbot」をCerbot.eff.orgよりダウンロードしてインストール。
 1.管理者モードでコマンドプロンプトを起動して、certbot.exe が入っているフォルダまで移動する。
 2.SSL証明書を取得する際Let’s EncryptがWebサーバーの所在確認をするのでApacheを停止させる。

② 準備が完了後、管理者モードのコマンドプロンプトでCerbotを起動

cd C:\Program Files (x86)\Certbot\binに移動して
「C:\Program Files (x86)\Certbot\bin > 「certbot.exe certonly」で「Enter」

Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): xxxxxxxxxx@gmail.com

 You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
Account registered.
Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c'
to cancel): osshinet.com
Successfully received certificate.
Certificate is saved at:
Key is saved at:
*自宅サーバドメイン用、次にサイト用の(www)を取得

-LetsencryptでSSL化-

Cerbot.eff.orgからダウンロードしたCerbotでLetsencryptのSSL証明書取得

success」と返答が加えらるとC:\に「Certbot」が出来ている。内容の確認した後にApacheのConf/extra内にあるhttpd-vhosts.confの最後の行に下記を追記する。

<VirtualHost *:80>
    ServerAdmin webmaster@osshinet.com
    DocumentRoot "C:/xampp/htdocs/wordpress"
    ServerName osshinet.com
    ServerAlias www.osshinet.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common

    <Directory c:\htdocs\wordpress>
	Options FollowSymlinks Includes
     	AllowOverride All
    	Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@osshinet.com
    DocumentRoot "C:/xampp/htdocs/wordpress"
    ServerName www.osshinet.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common

    SSLEngine on
    SSLCertificateFile "C:\Certbot\live\www.osshinet.com\cert.pem"
    SSLCertificateKeyFile "C:\Certbot\live\www.osshinet.com\privkey.pem"

    <Directory c:\htdocs\wordpress>
	Options FollowSymlinks Includes
     	AllowOverride All
    	Require all granted
    </Directory>
</VirtualHost>
*「Xampp Panel」をオープン、Apache、MySQLをスタートして終了。

Let’s Encrypt証明書は3ヵ月の有効期限付きなので、管理者モードでコマンドプロンプトを立ち上げ、「certbot renew」を実行することで証明書の期限が更新される。

最新の「Xampp」をインストールして自宅サーバを構築

先日までの自宅サーバ(PCのハードデスクが壊れた)の代替えで「WindowsのXampp」でサイトを立ち上げることにした。Xamppはテスト用のローカルサーバーという名目だけど実際には個人的なサイト程度で、セキュリティを考慮した上で運営するのであればと思い現時点で最新の「Xampp 8.0.12」をインストールすることにした。

 

Xampp

―Windows向けXamppで自宅サーバの構築-

ApacheFriends XAMPP Version 8.1.2

  1.Apache 2.4.51
  2.MariaDB 10.4.22
  3.PHP 8.0.13 (VS16 X86 64bit thread safe) + PEAR
  4.phpMyAdmin 5.1.1
  5.OpenSSL 1.1.0g
  6.Mercury Mail Transport System v4.63 (not included in the portable version)
  7.FileZilla FTP Server 0.9.41 (not included in the portable version)
 *その他(ユーティリティ)

Xamppはサーバ・パッケージなのでインストールも簡単、設定に関してもApache,MySQLの知識が少しあれば超簡単にサイトの公開ができる。又、Xamppに関する情報はネットに溢れているし、トラブルがあっても大抵のことは解決できるから安心できる。

TOP

Copyrighted Image