Advertisement
apfelcast

Apache Reverse Proxy Server

Nov 23rd, 2019
13,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #### create Apache Reverse Proxy Server Ubuntu ####
  2.  
  3. ## install apache2 ##
  4. apt-get update
  5. apt-get install apache2 -y
  6.  
  7. ## enable moduls ##
  8. a2enmod proxy
  9. a2enmod proxy_http
  10. a2enmod proxy_ajp
  11. a2enmod rewrite
  12. a2enmod deflate
  13. a2enmod headers
  14. a2enmod proxy_balancer
  15. a2enmod proxy_connect
  16. a2enmod proxy_html
  17. service apache2 restart
  18.  
  19. ## create config for 1st client ##
  20. nano /etc/apache2/sites-enabled/server1.conf
  21.  
  22. <VirtualHost *:80>
  23. ServerName subdomain11.yourdomain.com
  24. ProxyPreserveHost On
  25. DocumentRoot /var/www/html
  26. ProxyPass /.well-known !
  27. ProxyPass / http://10.1.1.11:80/
  28. ProxyPassReverse / http://10.1.1.11:80/
  29. </VirtualHost>
  30.  
  31. ## create config for 2nd client ##
  32. nano /etc/apache2/sites-enabled/server2.conf
  33. <VirtualHost *:80>
  34. ServerName subdomain12.yourdomain.com
  35. ProxyPreserveHost On
  36. DocumentRoot /var/www/html
  37. ProxyPass /.well-known !
  38. ProxyPass / http://10.1.1.12:80/
  39. ProxyPassReverse / http://10.1.1.12:80/
  40. </VirtualHost>
  41.  
  42. ## restart apache server ##
  43. service apache2 restart
  44.  
  45. ## install Let's Encrypt Certbot ##
  46. apt-get install python-certbot-apache
  47.  
  48. ## create certificates ##
  49. certbot --apache
  50.  
  51. #--> certificate only lasts 90 days
  52.  
  53. #install crontab
  54. crontab -e
  55.  
  56. 0 1 * * * /usr/bin/certbot renew & > /dev/nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement