===== Apache =====
==== Включить HTTP/2 ====
[[wp>HTTP/2]] поддерживается Апачем начиная с версии 2.4.17.
# Проверить версию Апача
apache2 -v
# Активировать поддержку HTTP/2
sudo a2enmod http2
# Добавить строки в соответствующие конфиги
# (/etc/apache2/sites-enabled, /etc/apache2/sites-available):
# Для ...
Protocols h2c http/1.1
# Для ...
Protocols h2 http/1.1
# Перезапустить Апач
service apache2 restart
# Перечень загруженных модулей
apachectl -t -D DUMP_MODULES
https://dmitriyilichev.com/perehod-na-http-2-ubuntu-apache/
Тесты:\\
https://tools.keycdn.com/http2-test\\
https://www.dareboost.com/en/website-speed-test-http2-vs-http1
В Apache 2.4.18 есть баг:
a2enmod http2
ERROR: Module http2 does not exist!
Решение:
apt-get install libnghttp2-dev
mkdir apache2
cd apache2
apt-get source apache2
apt-get build-dep apache2
cd apache-2.4.18
# apt-get install fakeroot
fakeroot debian/rules binary
cp debian/apache2-bin/usr/lib/apache2/modules/mod_http2.so /usr/lib/apache2/modules/
touch /etc/apache2/mods-available/http2.load
echo 'LoadModule http2_module /usr/lib/apache2/modules/mod_http2.so' > /etc/apache2/mods-available/http2.load
a2enmod http2
https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1543572
=== Apache 2.4.27, HTTP/2 not supported in prefork ===
Starting from Apache 2.4.27, the Apache MPM (Multi-Processing Module) prefork no longer supports HTTP/2. This will be indicated in your Apache error log as follows:
AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
To fix this, select a different MPM: event or worker. We highly recommend you to use the event prefork.
If you are using PHP, it is likely that PHP is integrated to Apache via the mod_php module, which requires the prefork MPM. If you switch out from preform MPM, you will need to use PHP as FastCGI. To switch to php-fpm, you can do as folllwing. Please note that this assumes you have PHP installed from ondrej/php repository on Ubuntu. The PHP package names could be different in other repositories. Change package name and apt-get commands to match your PHP vendor and package manager.
apachectl stop
apt-get install php7.1-fpm # Install the php-fpm from your PHP repository. This package name depends on the vendor.
a2enmod proxy_fcgi setenvif
a2enconf php7.1-fpm # Again, this depends on your PHP vendor.
a2dismod php7.1 # This disables mod_php.
a2dismod mpm_prefork # This disables the prefork MPM. Only one MPM can run at a time.
a2enmod mpm_event # Enable event MPM. You could also enable mpm_worker.
apachectl start
https://http2.pro/doc/Apache
==== Case-insensitive URIs ====
Redirect a URI to an all-lowercase version of itself
# Add RewriteMap for redirecting to lowercase URIs
RewriteMap lc int:tolower
RewriteRule "(.*)" "${lc:$1}" [R]
Please note that the example offered here is for illustration purposes only, and is not a recommendation. If you want to make URLs case-insensitive, consider using [[https://httpd.apache.org/docs/trunk/mod/mod_speling.html|mod_speling]] instead.
https://httpd.apache.org/docs/trunk/rewrite/rewritemap.html
mod_speling:
a2enmod speling
nano /etc/apache2/sites-available/000-default.conf
CheckSpelling On
CheckCaseOnly On
systemctl restart apache2
https://stackoverflow.com/questions/3450032/apache-mod-speling-case-insensitive-urls-issue\\
https://support.plesk.com/hc/en-us/articles/360000125574-How-to-avoid-case-sensitive-URLs-
==== Перенаправление ====
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
# Неполный адрес в полный
Redirect "/" "http://wiki.domain.ru/"
В HTML-файле:
https://stackoverflow.com/questions/37752440/relative-redirect-using-meta-http-equiv-refresh-with-gh-pages\\
https://stackoverflow.com/questions/5411538/redirect-from-an-html-page
==== OCSP Stapling ====
# Edit your site’s VirtualHost SSL configuration.
# Add the following line INSIDE the block:
SSLUseStapling on
# Add the following line OUTSIDE the block:
SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
# Check the configuration for errors with the Apache Control service.
Apachectl -t
# Reload the Apache service.
service apache2 reload
https://www.digicert.com/kb/ssl-support/apache-enable-ocsp-stapling-on-server.htm
====== Tomcat ======
---
# Простой запуск в докере
# docker run --rm --name tomcat -p 8080:8080 -v ./sample.war:/usr/local/tomcat/webapps/sample.war tomcat:jre11
services:
tomcat:
image: tomcat:jre11
container_name: tomcat
ports:
- 8080:8080
volumes:
- ./sample.war:/usr/local/tomcat/webapps/sample.war
Доступ к приложению - http://localhost:8080/sample
https://hub.docker.com/_/tomcat\\
https://tomcat.apache.org/tomcat-10.1-doc/appdev/sample/ (тестовое приложение)
Показать версию
docker exec -it tomcat bash -c '/usr/local/tomcat/bin/version.sh'
https://stackoverflow.com/questions/14925073/tomcat-how-to-find-out-running-tomcat-version