Tutorials - Apache

Video thumbnail image for Make Nextcloud fast!  Full tutorial and server setup!

Make Nextcloud fast! Full tutorial and server setup!

Nextcloud is a great system for setting up your personal cloud and sharing with friends. It can be frustrating when it is slow. Let's get nextcloud entirely setup and optimized for performance on your server! ** PHP 8.3 is out. Nextcloud currently will NOT run on php8.3. Many required php packages for php8.3 are not out yet, such as intl, mysql, curl, and others** ** This guide has been updated to specify installing php 8.2 packages, be sure you are running php8.2!** **Nextcloud 28 is out, it also wants you to install bz2 php extension** **sudo apt-get install php8.2-bz2** *Server setup* sudo apt-get update sudo apt-get upgrade sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get install apache2 php8.2-fpm sudo nano /etc/apache2/sites-available/nextcloud.conf *paste in the code from here:* https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Nextlcoud sudo a2enconf php8.2-fpm sudo a2ensite nextcloud.conf sudo apt-get install imagemagick php8.2-imagick memcached libmemcached-tools php8.2-memcached php8.2-apcu mariadb-server php8.2-gd php8.2-mysql php8.2-curl php8.2-mbstring php8.2-intl php8.2-gmp php8.2-bcmath php8.2-xml php8.2-zip unzip smbclient sudo a2enmod headers rewrite mpm_event http2 mime proxy proxy_fcgi setenvif alias dir env ssl proxy_http proxy_wstunnel sudo a2dismod mpm_prefork sudo nano /etc/memcached.conf change 64 to 1024 *save and exit* sudo nano /etc/php/8.2/fpm/pool.d/www.conf max_children = 80 start_servers = 20 min_spare_servers = 20 max_spare_servers = 60 *uncomment these lines:* env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp *save and exit* sudo nano /etc/php/8.2/fpm/php.ini memory_limit = 1024M post_max_size = 512M upload_max_filesize = 1024M *down in opcache settings:* opcache.enable=1 opcache.memory_consumption=1024 opcache.interned_strings_buffer=64 opcache.max_accelerated_files=150000 opcache.max_wasted_percentage=15 opcache.revalidate_freq=60 opcache.save_comments=1 opcache.jit=1255 opcache.jit_buffer_size=256M *save and exit* *setup MariaDB* sudo mysql CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost'; FLUSH PRIVILEGES; quit; cd /var/www sudo wget https://download.nextcloud.com/server/releases/nextcloud-27.1.4.zip sudo unzip nextcloud-27.1.4.zip sudo chown -R www-data:www-data /var/www/nextcloud sudo systemctl restart apache2 sudo systemctl restart memcached sudo systemctl restart php8.2-fpm *open website and continue nextcloud isntallation on new website* sudo nano /var/www/nextcloud/config/config.php *grab the code to add from here:* https://github.com/jhodak/linux-configuration-files/blob/main/nextcloud/config save and exit sudo systemctl restart apache2 just in case. *Your nextcloud should now be running optimally!* **Optional but highly recommended** Enable OCC -- nextcloud command line function sudo nano /etc/php/8.2/mods-available/apcu.ini *add the following line at the bottom:* apc.enable_cli=1 save and exit in nextcloud go to administration settings -- basic settings -- change from Ajax to Cron (recommended) if you want to test if cron is working sudo -u www-data php -f /var/www/nextcloud/cron.php if you see nothing it is working, if you get an error it is not working

Watch Video on Youtube

Published on: 11/2/2023

Video thumbnail image for Apache reverse proxy to ESXI hypervisor

Apache reverse proxy to ESXI hypervisor

Use Apache to apply SSL certificates and reverse proxy to your ESXI server! Apache commands cd /etc/apache2/sites-available/ sudo nano esxi.conf paste in https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Apache_redirect_to_https sudo nano esxi-le-ssl.conf paste in https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Esxi make changes to ip addresses servername ssl cert location add modules for apache sudo a2enmod ssl proxy proxy_wstunnel proxy_http headers alias rewrite setenvif enable sites in apache sudo a2ensite esxi.conf esxi-le-ssl.conf reload apache sudo systemctl reload apache2

Watch Video on Youtube

Published on: 10/27/2023

Video thumbnail image for Reverse Proxy to Unifi OS with SSL cert in apache!

Reverse Proxy to Unifi OS with SSL cert in apache!

Want to get rid of those security warning screens and setup proper SSL certs on your UDM Pro or Unifi OS? This video walks through setting up a proper reverse proxy in apache, and using a let's encrypt SSL cert. Apache sites-available cd /etc/apache2/sites-available sudo nano unifi.conf paste in: https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Apache_redirect_to_https sudo nano unifi-le-ssl.conf paste in: https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Unifi_UDM_Pro sudo a2ensite unifi.conf unifi-le-ssl.conf sudo a2enmod headers proxy proxy_wstunnel ssl alias rewrite setenvif proxy_http sudo systemctl reload apache2

Watch Video on Youtube

Published on: 10/26/2023

Video thumbnail image for How to optimize PHP use php-fpm on apache, and setup memcached and opcache!

How to optimize PHP use php-fpm on apache, and setup memcached and opcache!

PHP needs your help! Get wordpress, nextcloud, or any PHP application on your web server way faster by configuring php-fpm, using opcache and memcached. Super easy ways to massively improve performance!

Watch Video on Youtube

Published on: 10/24/2023

Video thumbnail image for Wildcard SSL Certificates using Apache + Route53 + Lets Encrypt...Let's go!

Wildcard SSL Certificates using Apache + Route53 + Lets Encrypt...Let's go!

Do you use apache? Do you use AWS Route 53? Do you want to get a star cert to use SSL on everything? Let's setup apache to use lets encrypt and setup automated star certs on a domain hosted in AWS Route 53! Commands from the video: install certbot sudo snap install --classic certbot set symlink for certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot allow certbot to run properly sudo snap set certbot trust-plugin-with-root=ok install certbot dns agent for route 53 sudo snap install certbot-dns-route53 Page with certbot route53 Policy: https://certbot-dns-route53.readthedocs.io/en/stable/ open and set aws config file: sudo nano ~/.aws/config move to apache sites-available cd /etc/apache2/sites-available create new site virtual host: sudo nano sitename.conf Get site config: https://github.com/jhodak/linux-configuration-files/blob/main/Apache_Reverse_Proxy_Configs/Apache_redirect_to_https Add site to apache sudo a2ensite sitename.conf reload apache: sudo systemctl reload apache2 Get cert from let's encrypt: sudo certbot run --dns-route53 -d "sitename.com" -d "*.sitename.com" -i apache Run certbot dry run to test if it can update certs automatically sudo certbot run --dry-run --dns-route53 -d "sitename.com" -d "*.sitename.com" -i apache

Watch Video on Youtube

Published on: 10/19/2023

Video thumbnail image for Apache Reverse Proxy to Proxmox... yes please!

Apache Reverse Proxy to Proxmox... yes please!

Have an apache server? Are you using proxmox? Let's use your apache server to serve your proxmox user interface with an SSL certificate. Let's get rid of those "Unsafe website" messages, because mindlessly clicking continue to unsafe websites is a bad habit. This video goes over setting up a virtual host in apache to act as a reverse proxy to your Proxmox server. This is useful for applying SSL certificates through Apache that will be applied to your proxmox server. Say goodbye to irritating "unsafe website" warnings. Apache enable modules command: `sudo a2enmod ssl proxy rewrite proxy_http proxy_wstunnel headers alias setenvif` Apache enable site: `sudo a2ensite example.conf example-le-ssl.conf` Apache reload: `sudo service apache2 reload` Redirect http to https - https://raw.githubusercontent.com/jhodak/linux-configuration-files/main/Apache_Reverse_Proxy_Configs/Apache_redirect_to_https Virtual Host reverse proxy to proxmox - https://raw.githubusercontent.com/jhodak/linux-configuration-files/main/Apache_Reverse_Proxy_Configs/ProxMox

Watch Video on Youtube

Published on: 10/16/2023