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
Last revisionBoth sides next revision
deb11:apache [2022/09/25 23:31] Bernard Condraudeb11:apache [2023/01/16 19:58] – [VirtualHost on the "proxy" server] 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 88: Line 90:
 Configuring for: Configuring for:
 ... ...
-Zend Module Api No:      20190902 (7.4), 20200930 (8.0), 20210902 (8.1) +Zend Module Api No:      20200930 (8.0), 20210902 (8.1) 
-Zend Extension Api No:   320190902 (7.4), 420200930 (8.0), 420210902 (8.1)</code>+Zend Extension Api No:   420200930 (8.0), 420210902 (8.1)</code>
   - If it does not, you are using the wrong phpize. Please follow [[https://xdebug.org/docs/faq#custom-phpize|this FAQ entry]] and skip the next step.   - If it does not, you are using the wrong phpize. Please follow [[https://xdebug.org/docs/faq#custom-phpize|this FAQ entry]] and skip the next step.
   - Run:<code>./configure   - Run:<code>./configure
 make</code> make</code>
-  - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20190902, 20200930, 20210902}</code> +  - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20200930, 20210902}</code> 
-  - Xdebug 2: +  - Create ''/etc/php/{8.0, 8.1}/apache2/conf.d/99-xdebug.ini'' for Xdebug 3 and add lines:<code>zend_extension     = xdebug 
-    - Modify the configuration in /etc/php/7.4/cli/php.ini:<code>zend_extension = /usr/lib/php/20190902/xdebug.so +xdebug.remote_port = 9000 (default: 9003) 
-xdebug.remote_enable=1 +xdebug.mode        = debug</code>
-xdebug.remote_port=9000 (default: 9000) +
-xdebug.profiler_enable=0  +
-xdebug.profiler_enable_trigger=1 +
-xdebug.profiler_output_dir=PATH_TO_PROFILER_OUTPUT_DIR +
-xdebug.remote_log=PATH_TO_LOG/xdebug.log</code> +
-    - Change the PATH_TO_PROFILER_OUTPUT_DIR to point to the directory you want to receive profiler output. change PATH_TO_LOG to point to the directory where you want to receive xdebug.log. +
-    - Make sure that zend_extension = /usr/lib/php/20190902/xdebug.so is below the line for OPcache. Please also update php.ini files in adjacent directories (//apache2// and //cli//), as your system might be configured with a separate php.ini file for the web server and command line. +
-  - Xdebug 3: +
-    - Create ''/etc/php/8.0/apache2/conf.d/99-xdebug.ini'' and add lines:<code>zend_extension = xdebug +
-xdebug.remote_port=9000 (default: 9003) +
-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 175: 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]]