• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

apache

Wiki SSL Certificate Location

November 12, 2021

Here’s where the Wiki keeps its SSL certificate keys.

/etc/pki/tls/certs/yourdomain.crt
/etc/pki/tls/private/yourdomain.key

/etc/pki/tls/certs/yourdomain.crt /etc/pki/tls/private/yourdomain.key

In some cases, SSL needs to be converted so it doesn’t prompt you for a password if you restart Apache.

Conversion

openssl rsa -in /etc/pki/tls/private/yourdomain.key.new -out /etc/pki/tls/private/yourdomain.key.new_no_pass

openssl rsa -in /etc/pki/tls/private/yourdomain.key.new -out /etc/pki/tls/private/yourdomain.key.new_no_pass

Filed Under: Linux Tagged With: apache, certificate, location, password, ssl, wiki

Create Local Yum Repo

November 7, 2021

Here’s how to create a local yum repo.

Install Apache.

sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd

sudo yum install httpd sudo systemctl start httpd sudo systemctl enable httpd sudo systemctl status httpd

Install the repo packages.

sudo yum install createrepo yum-utils

sudo yum install createrepo yum-utils

Create repo directories.

sudo mkdir /var/www/html/{baseos,extras,appstream,epel}

sudo mkdir /var/www/html/{baseos,extras,appstream,epel}

Sync the repos.

sudo yum reposync -p=/var/www/html --repoid=baseos --download-metadata
sudo yum reposync -p=/var/www/html --repoid=extras --download-metadata
sudo yum reposync -p=/var/www/html --repoid=appstream --download-metadata
sudo yum reposync -p=/var/www/html --repoid=epel --download-metadata

sudo yum reposync -p=/var/www/html --repoid=baseos --download-metadata sudo yum reposync -p=/var/www/html --repoid=extras --download-metadata sudo yum reposync -p=/var/www/html --repoid=appstream --download-metadata sudo yum reposync -p=/var/www/html --repoid=epel --download-metadata

Create a new repo.

sudo createrepo /var/www/html/

sudo createrepo /var/www/html/

Setup a local repo.

sudo nano /etc/yum.repos.d/local.repo

sudo nano /etc/yum.repos.d/local.repo

Contents of local.repo.

local-base]
name=Yum Local Base
baseurl=http://10.10.0.20:80/base
enabled=1
gpgcheck=0
[local-extras]
name=Yum Local Extras
baseurl=http://10.10.0.20:80/extras
enabled=1
gpgcheck=0
[local-appstream]
name=Yum Local Appstream
baseurl=http://10.10.0.20:80/appstream
enabled=1
gpgcheck=0
[local-epel]
name=Yum Local Epel
baseurl=http://10.10.0.20:80/epel
enabled=1
gpgcheck=0

local-base] name=Yum Local Base baseurl=http://10.10.0.20:80/base enabled=1 gpgcheck=0 [local-extras] name=Yum Local Extras baseurl=http://10.10.0.20:80/extras enabled=1 gpgcheck=0 [local-appstream] name=Yum Local Appstream baseurl=http://10.10.0.20:80/appstream enabled=1 gpgcheck=0 [local-epel] name=Yum Local Epel baseurl=http://10.10.0.20:80/epel enabled=1 gpgcheck=0

Confirm new repo is in the repolist.

sudo yum repolist

sudo yum repolist

Filed Under: Linux Tagged With: apache, create, repo, yum

Tomcat Install

June 4, 2021

Tomcat requires JRE.

wget jre-8uversion-linux-x64.tar.gz
# or
apt-get install default-jdk

wget jre-8uversion-linux-x64.tar.gz # or apt-get install default-jdk

Install Tomcat 8 on Linux.

wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz
tar zxpvf apache-tomcat-8.5.66.tar.gz
cd /opt/tomcat/apache-tomcat-8.5.66/bin/
./startup.sh

wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz tar zxpvf apache-tomcat-8.5.66.tar.gz cd /opt/tomcat/apache-tomcat-8.5.66/bin/ ./startup.sh

Status|Start|Stop|Restart Tomcat.

systemctl status tomcat8
systemctl start tomcat8
systemctl stop tomcat8
systemctl restart tomcat8

systemctl status tomcat8 systemctl start tomcat8 systemctl stop tomcat8 systemctl restart tomcat8

Filed Under: Misc Tagged With: apache, install, restart, server, start, status, stop, tomcat, web

Ubuntu 20.04 LTS Lamp Server

November 10, 2020

Here’s how to install a LAMP server on the latest Ubuntu 20.04 LTS.

Install Apache.

apt install apache2
systemctl status apache2
systemctl is-enabled apache2

apt install apache2 systemctl status apache2 systemctl is-enabled apache2

Install MariaDB.

apt install mariadb-server mariadb-client
systemctl status mariadb
systemctl is-enabled mariadb
mysql_secure_installation

apt install mariadb-server mariadb-client systemctl status mariadb systemctl is-enabled mariadb mysql_secure_installation

Install PHP.

apt install php libapache2-mod-php php-mysql
systemctl restart apache2

apt install php libapache2-mod-php php-mysql systemctl restart apache2

Enable ssl and mod_rewrite.

a2enmod ssl
a2enmod rewrite
systemctl restart apache2

a2enmod ssl a2enmod rewrite systemctl restart apache2

Filed Under: Linux Tagged With: apache, lamp, lts, mariadb, mod_rewrite, php, ssl, ubuntu 20.04

Clients Connected to Apache

July 25, 2020

Here’s how to find if clients are connected to Apache or Nginx service.

netstat -tn src: 80
netstat -tn src: 443

netstat -tn src: 80 netstat -tn src: 443

Filed Under: Linux Tagged With: 443, 80, apache, clients, connection

Standard SSL Policy

February 9, 2020

Here’s a standard template for SSL Apache found in /etc/apache2/sites-available/default-ssl.conf.

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
   ServerAdmin your-email@your-domain.com
   ServerName www.yourdomain.com
   ServerName yourdomain.com
   DocumentRoot /var/www/your-domain.com
   ErrorLog /var/www/your-domain.com/log/error.log
   CustomLog /var/www/your-domain.com/log/access.log combined
   <Directory /var/www/your-domain.com>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Require all granted
   </Directory>
   SSLCertificateFile /etc/letsencrypt/live/your-domain.com/fullchain.pem
   SSLCertificateKeyFile /etc/letsencrypt/live/your-domain.com/privkey.pem
   Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin your-email@your-domain.com ServerName www.yourdomain.com ServerName yourdomain.com DocumentRoot /var/www/your-domain.com ErrorLog /var/www/your-domain.com/log/error.log CustomLog /var/www/your-domain.com/log/access.log combined <Directory /var/www/your-domain.com> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> SSLCertificateFile /etc/letsencrypt/live/your-domain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/your-domain.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>

Enable SSL.

# Enable SSL Module
a2enmod ssl
systemctl restart apache2.service
# Enable SSL Apache Config
a2ensite default-ssl
systemctl restart apache2.service
# Alternate way to restart.
service apache2 restart

# Enable SSL Module a2enmod ssl systemctl restart apache2.service # Enable SSL Apache Config a2ensite default-ssl systemctl restart apache2.service # Alternate way to restart. service apache2 restart

Filed Under: Linux Tagged With: 443, apache, config, ssl

WordPress Permalinks Not Working

January 28, 2020

Here’s a couple of things you can do to check if WordPress permalinks is not working.

  1. Make sure .htaccess has the right permissions.
  2. Make sure a2enmod Apache module is enabled.
  3. Restart the Apache server.
chmod 664 /var/www/domain.com/.htaccess
a2enmod rewrite
systemctl restart apache2

chmod 664 /var/www/domain.com/.htaccess a2enmod rewrite systemctl restart apache2

Filed Under: Linux Tagged With: .htaccess, a2enmod, apache, restart, rewrite, wordpress

GCP Web Server

January 8, 2020

Here’s a quick script to stand up a web server based on Centos image.

gcloud compute instances create [VM-NAME] \
    --zone=[ZONE] \
    --image-family=debian-9 \
    --image-project=debian-cloud \
    --tags=allow-ssh,allow-health-check \
    --subnet=lb-subnet \
    --metadata=startup-script='#! /bin/bash
apt-get update
apt-get install apache2 -y
a2ensite default-ssl
a2enmod ssl
vm_hostname="$(curl -H "Metadata-Flavor:Google" \
http://169.254.169.254/computeMetadata/v1/instance/name)"
echo "Page served from: $vm_hostname" | \
tee /var/www/html/index.html
systemctl restart apache2'

gcloud compute instances create [VM-NAME] \ --zone=[ZONE] \ --image-family=debian-9 \ --image-project=debian-cloud \ --tags=allow-ssh,allow-health-check \ --subnet=lb-subnet \ --metadata=startup-script='#! /bin/bash apt-get update apt-get install apache2 -y a2ensite default-ssl a2enmod ssl vm_hostname="$(curl -H "Metadata-Flavor:Google" \ http://169.254.169.254/computeMetadata/v1/instance/name)" echo "Page served from: $vm_hostname" | \ tee /var/www/html/index.html systemctl restart apache2'

Filed Under: Cloud Tagged With: apache, debian, gcp, metadata, server, vm, web

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023