Posts

Force HTTPS code using htaccess & web.config

  Below would be the code to force https in htaccess RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https: //%{HTTP_HOST}%{REQUEST_URI} [L,R=301]   Below would be the code to force https in web.config     <?xml version="1.0" encoding="UTF-8"?> < configuration > < system.webServer > < rewrite > < rules > < clear /> < rule name = "Redirect to https" stopProcessing = "true" > < match url = ".*" /> < conditions > < add input = "{HTTPS}" pattern = "off" ignoreCase = "true" /> </ conditions > < action type = "Redirect" url = "https://{HTTP_HOST}{REQUEST_URI}" redirectType = "Permanent" appendQueryString = "false" /...

Access Mysql from docker container and export the database

To access the database, first we need to enter into the container. Below is the command: Following command will show list of docker containers docker ps We have found that the container (container_name) has the sql database hosted. Below is the query to access the container docker exec -it  container_name bash Once we enter into bash, use following command to access with root permission mysql -u username -p password To Export database below is the command for the same: docker exec container_name /usr/bin/mysqldump --single-transaction -uusername --password=password databasename> backup.sql

No space left on device: AH00023: Couldn't create the mpm-accept mutex

 No space left on device: AH00023: Couldn't create the mpm-accept mutex The issue is caused due to Apache running out of Semaphores.  Semaphores are used for communicating between the active processes of a certain application. In the case of Apache,  Semaphores are used to communicate between the parent and child processes.  Generally, Apache cleans up these things itself, but sometimes it can’t due to some semaphores getting stuck.  Then it can’t communicate properly with the newly started processes. Hence, the Apache/HTTPD goes down.   To resolve this issue,   run below command   ipcs -s | awk -v user=apache '$3==user {system("ipcrm -s "$2)}' Once done, you need to run apache/httpd restart.  The issue will be resolved.

Install SSL in ubuntu server

Image
 Hi All, Below are the details for installing ssl on linux server At First lets create a private key. Below command needs to be run for the same sudo openssl genrsa -out private.key   Once done, we can proceed generating CSR for the same Below is the command and steps: sudo openssl req -new -key private.key -out csr.pem Next step would be enterng below information it will ask for: Country Name (country code) example IN, GB etc State Name:  Locality Name:  Organization Name: Organization Unit : Mostly it is IT Common Name: Domain or Website name Email Address :  Then it will ask for challenge password and company name. Skip it by pressing enter. Use vi command to get the csr code: here in this case sudo vi csr.pem Copy all the code by selecting the same and then paste it in your providers panel. Once you get the certificate files, upload the same to a directory. You can name it anything. I name it as certs. Once the files are exported. We can go and edit our vir...

Install LAMP on ubuntu server

Below commands are needed while installing LAMP server 1. To install Apache on the server run below commands   sudo apt update sudo apt install apache2 2. To check  if Apache is installed on your server run below command sudo service apache2 status and then browse http://serverip// It will show default Apache page    3. To install  mysql server run below commands: sudo apt install mysql-server sudo mysql_secure_installation 4. To install MariaDB run below commands:  sudo apt install mariadb-server sudo mysql_secure_installation 5. To install PHP run below commands:  sudo apt install openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip      Do let me know in case of any queries.