Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deb11:apache [2022/09/25 23:46] – [Xdebug] Bernard Condraudeb11:apache [2023/01/16 19:59] (current) Bernard Condrau
Line 8: Line 8:
   - Create sub folders in ''/var/log/apache2'' if you setup log files for the virtual hosts in sub folders   - Create sub folders in ''/var/log/apache2'' if you setup log files for the virtual hosts in sub folders
   - Install and configure [[deb11:certbot|Let's Encrypt Certbot]]   - Install and configure [[deb11:certbot|Let's Encrypt Certbot]]
 +  - If you are migrating from an old server, follow the [[deb11:migrate#apache_2.4|How to migrate a (web) server]] guide
  
 ===== Apache Settings ===== ===== Apache Settings =====
Line 16: Line 17:
  
 ==== MaxRequestedWorkers ==== ==== MaxRequestedWorkers ====
-Modify /etc/apache2/mods-available/mdm-prefork.conf and restart apache2<code>$ sudo apache2ctl -V | grep MPM +Modify /etc/apache2/mods-available/mpm-prefork.conf and restart apache2<code>$ sudo apache2ctl -V | grep MPM 
-vim /etc/apache2/mods-available/mdm-prefork.conf+vim /etc/apache2/mods-available/mpm-prefork.conf
   MaxRequestedWorkers 400   MaxRequestedWorkers 400
   ServerLimit 400   ServerLimit 400
Line 43: Line 44:
  
 ===== PHP Extensions ===== ===== PHP Extensions =====
-  * PHP extensions for Joomla:<code>$ sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip} phpV.v-{bcmath}</code> +  * PHP extensions for Joomla:<code>$ sudo apt install phpV.v-{bz2 curl gd mbstring mysql xml zip} phpV.v-{bcmath}</code> 
-  * PHP extensions for Wiki:<code>$ sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip} phpV.v-{sqlite3}</code>+  * PHP extensions for Wiki:<code>$ sudo apt install phpV.v-{bz2 curl gd mbstring mysql xml zip} phpV.v-{sqlite3}</code>
   * PHP extensions for phpMyAdmin:<code>$ sudo apt install phpV.v-mbstring</code>   * PHP extensions for phpMyAdmin:<code>$ sudo apt install phpV.v-mbstring</code>
 +  * PHP extensions for vps:<code>$ sudo apt install phpV.v-{curl xml zip}</code>
   * Required for PHP7:<code>$ sudo apt install phpV.v-json</code>   * Required for PHP7:<code>$ sudo apt install phpV.v-json</code>
   * Restart the service with one of the 2 commands below:<code>$ sudo systemctl restart apache2   * Restart the service with one of the 2 commands below:<code>$ sudo systemctl restart apache2
Line 94: Line 96:
 make</code> make</code>
   - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20200930, 20210902}</code>   - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20200930, 20210902}</code>
-  - Create ''/etc/php/{8.0, 8.1}/apache2/conf.d/99-xdebug.ini'' for Xdebug 3 and add lines:<code>zend_extension = xdebug +  - Create ''/etc/php/{8.0, 8.1}/apache2/conf.d/99-xdebug.ini'' for Xdebug 3 and add lines:<code>zend_extension     = xdebug 
-xdebug.remote_port=9000 (default: 9003) +xdebug.remote_port = 9000 (default: 9003) 
-xdebug.mode=debug</code>+xdebug.mode        = debug</code>
   - Restart your webserver.   - Restart your webserver.
   - Create a PHP page that has phpinfo(). Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful!   - Create a PHP page that has phpinfo(). Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful!
Line 115: Line 117:
 icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F
 icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F /t</code> icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F /t</code>
- 
  
 ==== Links ==== ==== Links ====
Line 123: Line 124:
   * [[https://webmasters.stackexchange.com/questions/126557/what-is-the-difference-of-certbot-and-certbot-auto|What is the difference of certbot and certbot-auto?]]   * [[https://webmasters.stackexchange.com/questions/126557/what-is-the-difference-of-certbot-and-certbot-auto|What is the difference of certbot and certbot-auto?]]
   * [[https://www.jesusamieiro.com/remove-revoke-a-domain-in-lets-encrypt/|Remove a domain in Let’s Encrypt]]   * [[https://www.jesusamieiro.com/remove-revoke-a-domain-in-lets-encrypt/|Remove a domain in Let’s Encrypt]]
 +
 ===== SSL for localhost ===== ===== SSL for localhost =====
 ==== Ignore invalid certificates ==== ==== Ignore invalid certificates ====
Line 164: Line 166:
   * [[https://www.digicert.com/kb/ssl-support/apache-fix-common-ssl-errors.htm|Troubleshooting Apache SSL Certificate Errors]]   * [[https://www.digicert.com/kb/ssl-support/apache-fix-common-ssl-errors.htm|Troubleshooting Apache SSL Certificate Errors]]
 ===== Proxy ===== ===== Proxy =====
-* Setup a VirtualHost on your main apache server, which for this example is now called "proxy". +Follow the guide [[deb11:apache-proxy|Apache Server with Proxy]] to setup access to proxied servers.
-* There needs to be another (regular) VirtualHost file on the backuppc server, which for this example is now called "host"+
-* The SSL certificates are served from the "proxy" through access to https://sub.domain.tld +
-* The "host" serves an unencrypted site through port 80. This assumes your local network is secure.+
  
-==== VirtualHost on the "proxy" server ==== 
-* sub.domain.tld: external domain name with which you access the "host" behind the "proxy" 
-* host.yourdomain.tld: internal domain name of your "host". You may also choose to have both names the same. 
-<code> 
-<VirtualHost *:80> 
-    ServerName sub.domain.tld 
-    Redirect 301 / https://sub.domain.tld 
-<VirtualHost> 
-<VirtualHost *:443> 
-    ServerName sub.domain.tld 
-    ServerAdmin you@domain.tld 
-    DocumentRoot /var/www/html/yoursite 
-     
-    SSLEngine on 
-    RedirectMatch ^/$ /yourapp/ # use this if backuppc is not the default app, or if you need to access another app on the same server 
-     
-    <Location "/yourapp/"> 
-          ProxyPass "http://host.yourdomain.tld/yourapp/" 
-          ProxyPassReverse "http://host.yourdomain.tld/yourapp/" 
-          Require all granted 
-    </Location> 
-     
-    # add other options such as Files and Directory permissions 
-     
-    Include /etc/letsencrypt/options-ssl-apache.conf 
-    SSLCertificateFile /etc/letsencrypt/live/sub.domain.tld/fullchain.pem 
-    SSLCertificateKeyFile /etc/letsencrypt/live/sub.domain.tld/privkey.pem 
-</VirtualHost> 
-</code> 
-==== Links ==== 
-  * [[https://serverfault.com/questions/486042/use-apache-as-a-https-to-http-proxy|Use apache as a HTTPS to HTTP Proxy]] 
-  * [[https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html|Reverse Proxy Guide]] 
-  * [[https://www.jamescoyle.net/how-to/116-simple-apache-reverse-proxy-example|Simple Apache reverse proxy example]] 
 ===== Links ===== ===== Links =====
   * [[https://www.itzgeek.com/how-tos/linux/debian/how-to-install-php-7-3-7-2-7-1-on-debian-10-debian-9-debian-8.html|How To Install PHP 7.4 / 7.3 / 7.2 / 7.1 on Debian 10 / Debian 9]]   * [[https://www.itzgeek.com/how-tos/linux/debian/how-to-install-php-7-3-7-2-7-1-on-debian-10-debian-9-debian-8.html|How To Install PHP 7.4 / 7.3 / 7.2 / 7.1 on Debian 10 / Debian 9]]