-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] Reverse Proxy Apache (Debian 8) Let's Encrypt

, 10 2017 . 22:45 +
, IP , Reverse Proxy. Microsoft TMG, , . , TMG , Let's Encrypt , 90 .

: Reverse Proxy Apache , Let's Encrypt. Firewall, http https.

Debian GNU/Linux 8 (jessie). .

-, .

aptitude install -y build-essential
aptitude install -y libapache2-mod-proxy-html libxml2-dev
aptitude install -y apache2

:

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_html
a2enmod proxy_ftp
a2enmod proxy_connect
a2enmod ssl

Apache:

service apache2 restart

, Apach' mod_xml2enc, ! Jessie , :

aptitude install apache2-prefork-dev libxml2 libxml2-dev apache2-dev
mkdir ~/modbuild/ && cd ~/modbuild/
wget http://apache.webthing.com/svn/apache/filters/mod_xml2enc.c
wget http://apache.webthing.com/svn/apache/filters/mod_xml2enc.h
apxs2 -aic -I/usr/include/libxml2 ./mod_xml2enc.c
cd ~
rm -rfd ~/modbuild/
service apache2 restart

, , . )

HTTPS , Let's Encrypt, , :

mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt

:

touch /etc/apache2/sites-available/sambi4.conf

:


ServerName sambi4.ru
Redirect permanent / https://sambi4.ru/ #    https



SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyVia full

SSLCertificateFile /etc/apache2/ssl/server.crt #     
SSLCertificateKeyFile /etc/apache2/ssl/server.key #      

ProxyHTMLInterp On
ProxyHTMLExtended On


Order deny,allow
Allow from all


ProxyPass / https://192.168.199.78/ #IP   .
ProxyPassReverse / https://192.168.199.78/ #IP   .
ServerName sambi4.ru
ServerAdmin sambi4@sambi4.ru #    email 
DocumentRoot "/var/www/html" #       ,        .

, :

a2ensite /etc/apache2/sites-available/sambi4.conf

Apache:

service apache2 restart

, Reverse Proxy Apache2, Let's Encrypt:

, Let's Encrypt, , 3 .

, .

echo 'deb http://ftp.debian.org/debian jessie-backports main' | tee /etc/apt/sources.list.d/backports.list

:

aptitude update

Let's Encrypt:

aptitude install -y python-certbot-apache -t jessie-backports

, :

certbot --apache

:
ERROR:letsencrypt_apache.configurator:No vhost exists with servername or alias of: sambi4.ru. No vhost was selected. Please specify servernames in the Apache config

, ( 0.10.2), . python-. :
certbot:

git clone https://github.com/certbot/certbot.git

, :

 cd /usr/lib/python2.7/dist-packages

( ):

acme
certbot
certbot_apache
:

cp /root/certbot/certbot /usr/lib/python2.7/dist-packages/
cp /root/certbot/acme/acme/ /usr/lib/python2.7/dist-packages/
cp /root/certbot/certbot-apache/certbot_apache/ /usr/lib/python2.7/dist-packages/

:

certbot --apache

!

, , , .. Let's Encrypt 90 ( ).

. cron :

30 2 * * 1 /usr/bin/certbot renew >> /var/log/le-renew.log

.. :

crontab -e

( , )

, .

, !
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/330670/

:  

: [1] []
 

:
: 

: ( )

:

  URL