Advertisement
load-net

apache2

Sep 18th, 2023 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.57 KB | None | 0 0
  1. apt update && apt upgrade
  2. apt install -y apache2 mc sudo
  3. systemctl status apache2
  4.  
  5.  
  6.  
  7.  
  8. mkdir -p /var/www/html/load.sytes.net/public
  9.  
  10. chmod -R 755 /var/www/html/load.sytes.net
  11. chown -R www-data:www-data /var/www/html/load.sytes.net
  12.  
  13. mcedit /etc/apache2/sites-available/load.sytes.net.conf
  14.  
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17. sudo apt update
  18. sudo apt install -y certbot
  19. sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
  20.  
  21. sudo mkdir -p /var/lib/letsencrypt/.well-known
  22. sudo chgrp www-data /var/lib/letsencrypt
  23. sudo chmod g+s /var/lib/letsencrypt
  24.  
  25. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  26.  
  27. mcedit /etc/apache2/conf-available/letsencrypt.conf
  28.  
  29. Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"
  30. <Directory "/var/lib/letsencrypt/">
  31. AllowOverride None
  32. Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  33. Require method GET POST OPTIONS
  34. </Directory>
  35.  
  36. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  37.  
  38. mcedit /etc/apache2/conf-available/ssl-params.conf
  39.  
  40. SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
  41. SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
  42. SSLHonorCipherOrder off
  43. SSLSessionTickets off
  44.  
  45. SSLUseStapling On
  46. SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
  47.  
  48. Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
  49. Header always set X-Frame-Options SAMEORIGIN
  50. Header always set X-Content-Type-Options nosniff
  51.  
  52. SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"
  53.  
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55.  
  56.  
  57. sudo a2enmod ssl
  58. sudo a2enmod headers
  59. sudo a2enmod http2
  60. sudo a2enconf letsencrypt
  61. sudo a2enconf ssl-params
  62. sudo systemctl reload apache2
  63.  
  64.  
  65.  
  66.  
  67. sudo certbot certonly --agree-tos --email [email protected] --webroot -w /var/lib/letsencrypt/ -d load.sytes.net
  68. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  69. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  70.  
  71. <VirtualHost *:80>
  72. ServerName load.sytes.net
  73. ServerAlias www.load.sytes.net
  74.  
  75. Redirect permanent / https://load.sytes.net/
  76. </VirtualHost>
  77.  
  78. <VirtualHost *:443>
  79. ServerName load.sytes.net
  80. ServerAlias www.load.sytes.net
  81.  
  82. Protocols h2 http/1.1
  83.  
  84. <If "%{HTTP_HOST} == 'www.load.sytes.net'">
  85. Redirect permanent / https://load.sytes.net/
  86. </If>
  87.  
  88. DocumentRoot /var/www/html/load.sytes.net/public
  89. ErrorLog ${APACHE_LOG_DIR}/load.sytes.net-error.log
  90. CustomLog ${APACHE_LOG_DIR}/load.sytes.net.log combined
  91.  
  92. SSLEngine On
  93. SSLCertificateFile /etc/letsencrypt/live/load.sytes.net/fullchain.pem
  94. SSLCertificateKeyFile /etc/letsencrypt/live/load.sytes.net/privkey.pem
  95.  
  96. # Other Apache Configuration
  97.  
  98. </VirtualHost>
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100.  
  101. sudo systemctl reload apache2
  102. 0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew --renew-hook "systemctl reload apache2"
  103.  
  104. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  105. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  106. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  107.  
  108.  
  109. a2ensite load.sytes.net.conf
  110. a2ensite default-ssl.conf
  111.  
  112. *********************************************************************
  113.  
  114. mcedit /var/www/html/load.sytes.net/public/index.html
  115.  
  116. <html>
  117. <head>
  118. <title>Welcome to load.um.sytes.net!</title>
  119. </head>
  120. <body>
  121. <h1>Success! The load.um.sytes.net virtual host is working!</h1>
  122. </body>
  123. </html>
  124.  
  125. ********************************************************************
  126.  
  127. a2ensite load.sytes.net.conf
  128.  
  129. a2ensite 000-default
  130. a2dissite 000-default
  131. a2dissite load.sytes.net.conf
  132.  
  133. systemctl reload apache2
  134.  
  135.  
  136. a2enmod {модуль} — подключение модуля;
  137. a2dismod {модуль} — отключение модуля;
  138. a2ensite {конфиг виртуального хоста} — подключает виртуальный хост;
  139. a2dissite {конфиг виртуального хоста} — отключает виртуальный хост.
  140.  
  141. sudo certbot certonly --agree-tos --email [email protected] --webroot -w /var/lib/letsencrypt/ -d load.sytes.net -d www.load.sytes.net
  142.  
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144.  
  145. sudo certbot renew --dry-run
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208. /////////////////////////////////////////////////////////////////////////////////
  209. apt update && apt upgrade
  210. apt install -y apache2 mc sudo
  211. systemctl status apache2
  212.  
  213.  
  214.  
  215.  
  216. mkdir -p /var/www/html/nginx.sytes.net/public
  217.  
  218. chmod -R 755 /var/www/html/nginx.sytes.net
  219. chown -R www-data:www-data /var/www/html/nginx.sytes.net
  220.  
  221. mcedit /etc/apache2/sites-available/nginx.sytes.net.conf
  222.  
  223. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  224. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  225.  
  226. <VirtualHost *:80>
  227. ServerName nginx.sytes.net
  228. ServerAlias www.nginx.sytes.net
  229.  
  230. Redirect permanent / https://nginx.sytes.net/
  231. </VirtualHost>
  232.  
  233. <VirtualHost *:443>
  234. ServerName nginx.sytes.net
  235. ServerAlias www.nginx.sytes.net
  236.  
  237. Protocols h2 http/1.1
  238.  
  239. <If "%{HTTP_HOST} == 'www.nginx.sytes.net'">
  240. Redirect permanent / https://nginx.sytes.net/
  241. </If>
  242.  
  243. DocumentRoot /var/www/html/nginx.sytes.net/public
  244. ErrorLog ${APACHE_LOG_DIR}/nginx.sytes.net-error.log
  245. CustomLog ${APACHE_LOG_DIR}/nginx.sytes.net.log combined
  246.  
  247. SSLEngine On
  248. SSLCertificateFile /etc/letsencrypt/live/nginx.sytes.net/fullchain.pem
  249. SSLCertificateKeyFile /etc/letsencrypt/live/nginx.sytes.net/privkey.pem
  250.  
  251. # Other Apache Configuration
  252.  
  253. </VirtualHost>
  254. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  255.  
  256. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  257. sudo apt update
  258. sudo apt install -y certbot
  259. sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
  260.  
  261. sudo mkdir -p /var/lib/letsencrypt/.well-known
  262. sudo chgrp www-data /var/lib/letsencrypt
  263. sudo chmod g+s /var/lib/letsencrypt
  264.  
  265. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266.  
  267. mcedit /etc/apache2/conf-available/letsencrypt.conf
  268.  
  269. Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"
  270. <Directory "/var/lib/letsencrypt/">
  271. AllowOverride None
  272. Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  273. Require method GET POST OPTIONS
  274. </Directory>
  275.  
  276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  277.  
  278. mcedit /etc/apache2/conf-available/ssl-params.conf
  279.  
  280. SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
  281. SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
  282. SSLHonorCipherOrder off
  283. SSLSessionTickets off
  284.  
  285. SSLUseStapling On
  286. SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
  287.  
  288. Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
  289. Header always set X-Frame-Options SAMEORIGIN
  290. Header always set X-Content-Type-Options nosniff
  291.  
  292. SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"
  293.  
  294. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  295.  
  296.  
  297. sudo a2enmod ssl
  298. sudo a2enmod headers
  299. sudo a2enmod http2
  300. sudo a2enconf letsencrypt
  301. sudo a2enconf ssl-params
  302. sudo systemctl reload apache2
  303.  
  304.  
  305.  
  306.  
  307. sudo certbot certonly --agree-tos --email [email protected] --webroot -w /var/lib/letsencrypt/ -d nginx.sytes.net
  308. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  309.  
  310. sudo systemctl reload apache2
  311. 0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew --renew-hook "systemctl reload apache2"
  312.  
  313. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  314. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  315. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  316.  
  317.  
  318. a2ensite load.sytes.net.conf
  319. a2ensite default-ssl.conf
  320.  
  321. *********************************************************************
  322.  
  323. mcedit /var/www/html/nginx.sytes.net/public/index.html
  324.  
  325. <html>
  326. <head>
  327. <title>Welcome to load.um.sytes.net!</title>
  328. </head>
  329. <body>
  330. <h1>Success! The load.um.sytes.net virtual host is working!</h1>
  331. </body>
  332. </html>
  333.  
  334. ********************************************************************
  335.  
  336. a2ensite nginx.sytes.net.conf
  337.  
  338. a2ensite 000-default
  339. a2dissite 000-default
  340. a2dissite load.sytes.net.conf
  341.  
  342. systemctl reload apache2
  343.  
  344.  
  345. a2enmod {модуль} — подключение модуля;
  346. a2dismod {модуль} — отключение модуля;
  347. a2ensite {конфиг виртуального хоста} — подключает виртуальный хост;
  348. a2dissite {конфиг виртуального хоста} — отключает виртуальный хост.
  349.  
  350. sudo certbot certonly --agree-tos --email [email protected] --webroot -w /var/lib/letsencrypt/ -d load.sytes.net -d www.load.sytes.net
  351.  
  352. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  353.  
  354. sudo certbot renew --dry-run
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement