User Tools

Site Tools


computing:selfhostedwp

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
Next revisionBoth sides next revision
computing:selfhostedwp [2023/06/29 04:29] oemb1905computing:selfhostedwp [2023/06/29 04:36] oemb1905
Line 18: Line 18:
      
   sudo apt-get install php8.2-{common,cgi,cli,zip,mysql,mbstring,intl,fpm,curl,gd,imagick,xml,xmlrpc,gpm,soap,opcache,apcu,bcmath}   sudo apt-get install php8.2-{common,cgi,cli,zip,mysql,mbstring,intl,fpm,curl,gd,imagick,xml,xmlrpc,gpm,soap,opcache,apcu,bcmath}
 +  
 +Apache2 will set up a 000-default.conf automatically and your host should now resolve. Be sure to set up TLS with certbot. Here's my preferred method:
 +
 +  ***
      
 In this particular configuration, I am not using libapache2-mod-php. Instead I am using mpm_event and php-fpm. This is not necessary for many smaller instances or self-hosted scenarios. If you are new to self-hosting, then in addition to the above steps, you should do ''sudo apt install libapache2-mod-php8.x'' and ignore the fpm-based steps below. In this particular configuration, I am not using libapache2-mod-php. Instead I am using mpm_event and php-fpm. This is not necessary for many smaller instances or self-hosted scenarios. If you are new to self-hosting, then in addition to the above steps, you should do ''sudo apt install libapache2-mod-php8.x'' and ignore the fpm-based steps below.
Line 37: Line 41:
   sudo systemctl restart apache2   sudo systemctl restart apache2
   sudo systemctl restart php8.2-fpm   sudo systemctl restart php8.2-fpm
-   + 
-Move index.php to the top priority as follows:+There are two standard ways to configure php-fpm. One of those is to use ProxyPassReverse, however, this will disable the use of .htaccess in your WordPress root which is not ideal. The next common way which I prefer and use here, is to add a FilesMatch condition to your virtual host as follows. Within the <Include> and </Include> portion of your default-ssl.conf virtual host, add something like: 
 + 
 +  <FilesMatch ".+\.ph(ar|p|tml)$"> 
 +      SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost" 
 +  </FilesMatch> 
 + 
 +That takes care of configuring php-fpm and mpm_event. Before proceeding, navigate to your tld.domain in a web browser and make sure that your site resolves properly. Now, to make sure that your WordPress index.php file resolves properly to display your home page, make sure to move index.php to the top priority as follows:
      
   sudo nano /etc/apache2/mods-enabled/dir.conf   sudo nano /etc/apache2/mods-enabled/dir.conf
   <DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm>   <DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm>
-  + 
 +*** 
 Optionally, we can install phpmyadmin, and if you do, you should secure as follows: Optionally, we can install phpmyadmin, and if you do, you should secure as follows:
  
Line 201: Line 213:
   </IfModule>   </IfModule>
  
- --- //[[jonathan@haacksnetworking.org|oemb1905]] 2023/06/29 04:09//+ --- //[[jonathan@haacksnetworking.org|oemb1905]] 2023/06/29 04:29//
computing/selfhostedwp.txt · Last modified: 2023/12/16 20:33 by oemb1905