Posts

How to redirect Drupal site from http to https?

Image
  Hello Guys, Today, We are going to see, how can we redirect our Drupal Site from http to https through .htaccess file with simple three lines of code. RewriteEngine On RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] In cases where the HTTPS/SSL connection is ended at the load balancer and all traffic is sent to instances on port 80, the following rule works to redirect non-secure traffic. RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Ensure the mod_rewrite module is loaded. Source: Stackoverflow

MySQL Commands, Administration, Backup, Restore

Image
  SOURCE : STACKOVERFLOW  To export If it’s an entire DB, then:  mysqldump -u [uname] -p[pass] db_name > db_backup.sql If it’s all DBs, then:  mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql If it’s specific tables within a DB, then:  mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql You can even go as far as auto-compressing the output using gzip (if your DB is very big):  mysqldump -u [uname] -p[pass] db_name | gzip > db_backup.sql.gz If you want to do this remotely and you have the access to the server in question, then the following would work (presuming the MySQL server is on port 3306):  mysqldump -P 3306 -h [ip_address] -u [uname] -p[pass] db_name > db_backup.sql To import Type the following command to import sql data file:  mysql -u username -p -h localhost DATA-BASE-NAME < data.sql In this example, import ‘data.sql’ file into ‘blog’ database using sat as username:  mysql -u sat -p -h localhost blog < data.sql If you h

How to install Let's Encrypt SSL Certificate in Ubuntu 18.04/NGINX?

In this post, we will see, how to install Let's Encrypt SSL Certificate on NGINX webserver. Steps are pretty straight forward and easy. First, add the repository: sudo add-apt-repository ppa:certbot/certbot   You’ll need to press ENTER to accept. Install Certbot’s Nginx package with apt: sudo apt install python-certbot-nginx    Install Let's Encrypt SSL Certificate sudo certbot --nginx -d jenkins.cloudshades.in      Follow the screen and provide the required input. Like email-id, permanent redirection to https etc.

How to reset MySQL root password in Ubuntu in latest Ubuntu versions 18.04 and above

Image
I have forget my MySQL root password and not able to login in phpMyAdmin. I am very bad in MySQL commandline. After long struggle while Googling, I found this solution in Stackoverflow - But this will work only latest Ubuntu version because of enhance security of MySQL.  First, as root, stop the mysql server.  systemctl stop mysql Next, create a /var/run/mysqld directory to be used by MySQL process to store and access socket file:  mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld Check that the newly created directory do exist. Now manually start MySQL with the following linux command and options:  /usr/sbin/mysqld --skip-grant-tables --skip-networking & Confirm that the process is running as expected:  jobs [1]+ Running sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking;  Leave that terminal running and open another terminal, not as root. Now access MySQL database without password:  mysql -u root -p mysql> Using the MySQL session first flush privileges:  FLUS

How to use APACHE/NGINX as reverse proxy?

Image
  In this post we will learn, how can we use apache and NGINX webserver as a reserve proxy. Means if we are using an application of different port and we want to use that application on port 80 or 443. For Apache Step 1: Install apache2 webserver sudo apt-get update sudo apt-get install apache2 -y [Check the apache installed or not and apache version] apache2 -v [Start the apache service if not running] sudo systemctl start apache2     [Enable apache service at boot time] sudo systemctl enable apache2 [Restart apache service] sudo systemctl restart apache2 Step 2: Create a configuration file under /etc/apache2/sites-availbale  [Like I have done in previous Jenkins post] cd /etc/apache2/sites-availbale Step 3: Add the following lines in the jenkins.conf file sudo vim jenkins.conf ServerName jenkins.domain ServerAlias www.jenkins.domain ProxyRequests Off ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ ProxyPassReverse / http://jenkins.host/ Order allow,deny A

How to Setup SFTP Server in CentOS 7

Image
  In this post we will see, how to install Secure FTP Server in CentOS 7 distribution: Image Source - ipswitch.com Step 1: Install FTP Package (Package Name is vsftpd) yum install vsftpd ftp -y The location of ftp folder is /var/ftp/pub Step 2: After installation of vsftpd open the configuration file of vsftpd and make some change given below - vim /etc/vsftpd/vsftpd.conf Edit some line Disable anonymous_enable=YES to NO Un-comment the line  ascii_upload_enable=YES ascii_download_enable=YES If you want, you can add the welcome message to un-comment ftpd_banner=Welcome to blah FTP service And, add a line at the bottom of the file # use_localtime=YES Save and Exit the file Step 3: Enable VSFTP on boot mode and Start the service Allow the ftp port on firewall firewall-cmd —permanent - -add-port=21/tcp firewall-cmd —permanent - -add-service=ftp firewall-cmd - -reload Disable SELinux boolean for FTP Service setsebool -P ftp_home_dir on Finally, Enable the VSFTPD service and boot mode and st

WordPress Themes and Plugins Installation Problem

Image
WordPress plugins and themes installation problem Step 1 – Add the following line at the end of wp-config.php file define( 'FS_METHOD' , 'direct' ); Step 2 – Give 777 recursive permission to wp-content folder chmod -R 777 wp-content Most probably, this will fix all the issues of yours. But in case, you have bought and theme and plugins from some website like themeforest of other site and your theme or size is more than the size mentioned in php.in file. Then you need to increase the size of followings – upload_max_size post_max_size max_execution_size etc. and restart the apache service OR Best Solution: Simply give www-data user to user and group onwership to website serving directory