server_configuration:apache

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
server_configuration:apache [2021/01/13 15:44] – created davidserver_configuration:apache [2022/07/22 16:39] (current) – [Core configuration] david
Line 1: Line 1:
 +====== Apache2 Configuration ======
  
 +The configuration is built from a DigitalOcean Droplet, preconfigured with LAMP and WordPress:
 +  * Droplet Information: https://do.co/34TfYn8
 +  * The WordPress One-Click Quickstart guide: https://do.co/34TfYn8#start
  
 +===== Core configuration =====
  
 +Note: If no site is "enabled" then a default entry seems to run hosting files under: ''/var/www/html''
  
-https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04 +Site configuration file location(s)
-- https://help.servmask.com/2018/10/27/how-to-increase-maximum-upload-file-size-in-wordpress/+<code bash> 
 +# All configuration files 
 +/etc/apache2/sites-available/
  
-  Move apache base location+# Enabled sites 
 +/etc/apache2/sites-enabled/ 
 +</code>
  
-====== SSL - Let's Encrypt ====== +Enable/disable configurations: 
- +<code bash> 
-How To Secure Apache with Let's Encrypt on Ubuntu 20.04 +# Disable 
-https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04+sudo a2dissite datablog.roman-halliday.com.conf
  
 +# Enable
 +sudo a2ensite datablog.roman-halliday.com.conf
 +</code>
 +===== File Ownership =====
 +Make sure all files are owned correctly:
 <code bash> <code bash>
-certbot --apache+# Site content owned by www-data so webserver can modify files 
 +chown -R www-data:www-data /var/www 
 + 
 +# Configuration owned by root for security 
 +chown -R root:root /etc/apache2
 </code> </code>
  
 +===== Refresh Configuration =====
 +Use one of:
 <code bash> <code bash>
 systemctl reload apache2 systemctl reload apache2
-service ssh reload+service apache2 reload
 </code> </code>
  
-<code>+===== SSL - Let's Encrypt ===== 
 +SSL Encryption (the use of ''https'' over ''http'') is a bit standard now, fortunately it's become a lot easier with the addition of [[https://letsencrypt.org/|Lets Encrypt]].
  
-# All configuration files +  * DigitalOcean Community Documentation: [[https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04|How To Secure Apache with Let's Encrypt on Ubuntu 20.04]]
-/etc/apache2/sites-available/+
  
-# Enabled sites +If you configure the http (non secure) websites under ''/etc/apache2/sites-enabled/'', then the ''certbot'' script will leverage [[https://letsencrypt.org/|Lets Encrypt]] to create certificates, configure them and create extra configuration files for the SSL (appending ''-le-ssl'' to the file name) and add a redirect to the original ''.conf'' file.
-/etc/apache2/sites-enabled/ +
-</code>+
  
-Make sure all files are owned correctly: 
 <code bash> <code bash>
-# Site content owned by www-data so webserver can modify files +certbot --apache
-chown -R ../ www-data:www-data /var/www +
- +
-# Configuration owned by root +
-chown -R ../ root:root /etc/apache2+
 </code> </code>
  
 +====== Troubleshooting ======
  
-NoteIf no site is "enabled" then a default entry seems to run hosting files under: ''/var/www/html''+  * https://help.servmask.com/2018/10/27/how-to-increase-maximum-upload-file-size-in-wordpress/ 
 + 
 + 
 +===== PHP testing page =====
  
 Hosting can be tested with the file: Hosting can be tested with the file:
Line 51: Line 69:
 </file> </file>
  
 +===== Managing Page redirects/apache changes =====
  
 +So many problems with cache in browsers. Good to test with a browser which can have all data cleared, and do work in private browsing.
 +
 +Using wget to test the apache configuration, see some extra samples and docs over at Computer Hope - Linux wget command.
 +
 +<code bash>
 +# Run a command to get the default page, and view the http redirects as returned by the server
 +wget --verbose datablog.roman-halliday.com
 +
 +# Reload apache configuration
 +sudo service apache2 reload
 +</code>
  
-====== Bug: extra index ======+===== Bug: extra index =====
 I had an extra ''index.html'' file from before. The old server prioritised ''php'' pages over ''php''. This one the other way around. It took time to realise the reason I was not getting one of the wiki pages working was because of the extra index.html'' file. I had an extra ''index.html'' file from before. The old server prioritised ''php'' pages over ''php''. This one the other way around. It took time to realise the reason I was not getting one of the wiki pages working was because of the extra index.html'' file.
 <code html> <code html>
  • server_configuration/apache.1610552641.txt.gz
  • Last modified: 2021/01/13 15:44
  • by david