「Xserver VPSでDebianサーバ構築/Webサーバ設定」の版間の差分
ナビゲーションに移動
検索に移動
157行目: | 157行目: | ||
<nowiki> |
<nowiki> |
||
$ |
$ systemctl --user enable ip-addr.timer |
||
$ |
$ systemctl --user start ip-addr.timer |
||
</nowiki> |
</nowiki> |
||
2024年5月23日 (木) 13:45時点における版
概要
次の表のとおりである。
Webサーバ | Apache |
証明書 | Let's Encrypt |
設定
以下の順に行う。
Apache設定
次のコマンドは、次項のcertbotコマンドにより有効化されるので、実行は不要である。
$ sudo a2enmod ssl $ sudo a2enmod rewrite $ sudo systemctl restart apache2
Let's Encrypt設定
次のコマンドを実行する。
$ sudo apt install python3-certbot-apache $ sudo certbot --apache
favicon.ico
/var/www/html/favicon.ico
analog
- /etc/analog.cfg
OUTFILE Report.html
$ analog /var/log/apache2/access.log* $ nkf --url-input Report.html > Report._dec.html
その他
Google Search Console
ドメインで登録する場合、TXTレコードをDNSサーバに設定する。
sitemap
- https://www.mediawiki.org/wiki/Manual:Sitemap/ja
- https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php/ja
MediaWiki バージョン: 1.32 – 1.39
$ php /usr/share/mediawiki/maintenance/generateSitemap.php --memory-limit=50M --fspath=/path/to/examplecom/sitemap/ --identifier=example.com --urlpath=/sitemap/ --server=https://www.example.com --compress=yes --skip-redirects
$ sudo systemctl edit --force --full sitemap.service
/etc/systemd/system/sitemap.service
[Unit] Description=sitemap [Service] Type=oneshot ExecStart=/usr/bin/php /usr/share/mediawiki/maintenance/generateSitemap.php --memory-limit=50M --fspath=/var/www/html/sitemap/ --identifier=medeshima.com --urlpath=/sitemap/ --server=https://www.medeshima.com --compress=yes --skip-redirects
$ sudo systemctl edit --force --full sitemap.timer
/etc/systemd/system/sitemap.timer
[Unit] Description=sitemap [Timer] OnCalendar=daily AccuracySec=1h Persistent=true [Install] WantedBy=timers.target
$ sudo systemctl enable sitemap.timer $ sudo systemctl start sitemap.timer
グローバルIP取得
Webサーバ
- /var/www/html/ip/index.php
<?php header("Content-Type: text/plain;charset=UTF-8"); echo $_SERVER['REMOTE_ADDR']; ?>
クライアント
$ curl https://SERVER/ip/
systemd timer
~/.config/systemd/user/ip-addr.service
[Unit] Description=IP address [Service] Type=oneshot ExecStart=curl -s https://SERVER/ip/ | mail -s "IP" MAIL
~/.config/systemd/user/ip-addr.timer
[Unit] Description=IP address [Timer] OnCalendar=daily AccuracySec=1h Persistent=true [Install] WantedBy=timers.target
$ systemctl --user enable ip-addr.timer $ systemctl --user start ip-addr.timer
cronの場合
$ crontab -e 0 6 * * * curl -s https://SERVER/ip/ | mail -s "IP" MAIL