WebDevJL / vps-manager

How is installed my VPSes
0 stars 0 forks source link

Enable HTTP/2 on VPS #30

Closed WebDevJL closed 6 years ago

WebDevJL commented 6 years ago

Source : https://www.rosehosting.com/blog/how-to-set-up-apache-with-http2-support-on-ubuntu-16-04/ Source 2 : https://korben.info/installter-activer-http2-apache2.html

WebDevJL commented 6 years ago

That's all:

#!/bin/bash
# $1 => UNIX user

cd ~

# to enable http/2, copy these lines into /etc/apt/sources.list
su -
vim /etc/apt/sources.list
#deb-src http://archive.ubuntu.com/ubuntu/ xenial main universe restricted multiverse
#deb-src http://security.ubuntu.com/ubuntu xenial-security main universe restricted multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main universe restricted multiverse

apt-get update && apt-get upgrade
apt-get install curl devscripts build-essential fakeroot

echo "Switch to the main user on the VPS (except root user)"
su $1
cd ~
sudo apt-get install libnghttp2-dev
mkdir apache2
cd apache2
apt-get source apache2
sudo apt-get build-dep apache2
cd apache2-2.4.18
sudo apt-get install curl devscripts build-essential fakeroot
fakeroot debian/rules binary
sudo cp debian/apache2-bin/usr/lib/apache2/modules/mod_http2.so /usr/lib/apache2/modules/
exit
cp vps-manager/assets/conf/apache2/mods-available/http2.load /etc/apache2/mods-available/http2.load

a2enmod http2
# add at the end:
#Protocols h2 http/1.1
apachectl configtest

apachectl restart

cd ~