Posts

Showing posts from 2022

root .htaccess file when laravel project upload in cpanel

 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule>

Understanding file permissions

Image
This string of letters, drwxrwxrwx , represents the permissions that are set for the directory. Each number can have one of eight values ranging from 0 to 7 . Each value corresponds to a certain setting of the read, write and execute permissions, as explained in the following table. For Example: 777 is the same as rwxrwxrwx 755 is the same as rwxr-xr-x 666 is the same as rw-rw-rw- 744 is the same as rwxr--r--

Deploy laravel application to digital ocean droplet

ssh root@192.168.0.1 adduser coderstation usermod -aG sudo coderstation su - coderstation sudo apt-get install apache2 sudo apt-get install php sudo apt-get install git sudo apt-get install composer sudo apt install mysql-server sudo mysql mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; mysql> exit mysql -u root -p mysql>ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket; sudo mysql_secure_installation mysql>CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password'; mysql>ALTER USER 'sammy'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; mysql>GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'sammy'@'localhost' WITH GRANT OPTION; mysql>FLUSH PRIVILEGES; mysql> exit cd /var/www/htm git clone project cd project sudo apt-get install php-xml sudo apt-get install

File/Folder Upload/Download From/To Local/Remote

 copy from remote to local scp file.txt remote_username@10.10.0.2:/remote/directory scp folder from server to local scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/ how to copy directory to a ssh server # Copy from machine a to b scp -r /path/to/directory user@ipaddress:/path/to/destination # Copy from machine b to a scp -r user@ipaddress:/path/to/destination /path/to/directory copy folder from ssh to local scp -r user@your.server.example.com:/path/to/foo / ssh copy folder from local to remote scp -ra /path/to/local/storage user@remote.host:/path/to/copy ssh copy folder from local to remote scp /path/of/your/local/filename username@hostname:/path/to/remote/server/folder

Server setup basic guide

 BASIC GUIDE ssh root@192.168.0.1 -p 22 adduser hasib ssh -l hasib 192.168.0.1 Update OS Install Apache Install MySQL Install PHP Install Composer (Composer install and globalization) sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin –filename=composer Install Git Set DNS Server Name to Domain Name Provider Panel

Git post receive setup at server for git push to the production from local machine

IN SERVER cd www mkdir repo cd repo mkdir app.website.git cd app.website.git git init –bare cd hooks touch post-receive chmod R 775 post-receive put the following line in post-receive file git --work-tree=/var/www/html/app.website.com --git-dir=/var/www/repo/app.website.git checkout master -f cd /var/www/html/app.website.com nano /etc/hosts 127.0.1.1 app.website.com cd /etc /apach2 /site-available cp 000-deault.conf app.website.com.conf LOCALLY git remote -v git remote add prod-website ssh://root@192.168.0.1:/var/www/repo/app.website.git

Way to get fillable fields from a specific table

SELECT CONCAT("'",COLUMN_NAME,"',") FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'undp_liupcp_survey' ORDER BY ORDINAL_POSITION ASC;