Skip to content

Instantly share code, notes, and snippets.

To calculate the process config
https://spot13.com/pmcalculator/
To get the size of the php fpm process size
ps -ylC php-fpm5.6 --sort:rss
#Compared a Key with certificate
__The below 2 commands hashed and if it matches then the private key and certificate are matching.__
openssl pkey -in privateKey.key -pubout -outform pem | sha256sum
openssl x509 -in cert.crt -pubkey -noout -outform pem | sha256sum
#Create CSR from existing key file
openssl req -key domain.key -new -out domain.csr
#Generate CSR
@mthabsheer
mthabsheer / Apache not Starting
Last active August 12, 2020 23:42
No space left on device: AH00023: Couldn’t create the rewrite-map mutex
While starting apache the below error pop up
No space left on device: AH00023: Couldn't create the ssl-cache mutex
Solution:
ipcs -s | awk -v user=apache '$3==user {system("ipcrm -s "$2)}'
Found solution from https://portal.cloudunboxed.net/knowledgebase/37/No-space-left-on-device-AH00023-Couldnt-create-the-rewrite-map-mutex.html
Find files in between dates
find /path/to/folder -type f -name "file_name_starts_with*" -newermt 2020-01-07 ! -newermt 2020-01-08 -ls
Find and delete
find /path/to/folder -type f -name "file_name_starts_with*" -newermt 2020-01-07 ! -newermt 2020-01-08 -delete
$ mkdir topdir
$ chgrp http topdir
$ chmod g+s topdir
$ cd topdir
$ git clone ....
cat "public key" >> ~/.ssh/authorized_keys
Allow Apache access to the folders and the files.
sudo chgrp -R www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+rx {} +
sudo find /var/www/html -type f -exec chmod g+r {} +
Give your owner read/write privileges to the folders and the files, and permit folder access to traverse the directory structure.
sudo chown -R USER /var/www/html/
sudo find /var/www/html -type d -exec chmod u+rwx {} +
sudo find /var/www/html -type f -exec chmod u+rw {} +
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
GRANT select ON dbname.* TO 'newuser'@'%'; //read only access
FLUSH PRIVILEGES;
apt-get install phpmyadmin php-mbstring php-gettext
#This file covers the steps for installing the SSL certificate in the Ubuntu 16.04 server.
1.Generate CSR
openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr
This will prompt for the following options
Common Name: The fully-qualified domain name, or URL, you're securing.
If you are requesting a Wildcard certificate, add an asterisk (*) to the left of the common name where you want the wildcard, for example *.coolexample.com.
Organization: The legally-registered name for your business. If you are enrolling as an individual, enter the certificate requestor's name.
Organization Unit: If applicable, enter the DBA (doing business as) name.
City or Locality: Name of the city where your organization is registered/located. Do not abbreviate.
--------------PHP versions----------------
sudo apt show php
OR
sudo apt show php -a
//install default PHP version
sudo apt install php
First start by adding Ondřej Surý PPA to install different versions of PHP – PHP 5.6, PHP 7.0 and PHP 7.1 on Ubuntu system.
sudo apt install python-software-properties
sudo add-apt-repository ppa:ondrej/php