Basic Docker Notes

To run a container from an image: 1 docker container run -it --rm ubuntu /bin/bash -t: terminal inside -i: (STDIN) grabbing --rm: remove container automatically when process exits --name: name the container or daemon -d: daemonize the container running To list all containers: 1 docker container ps -a To start or stop container: 1 docker container stop container_name To remove container(s): 1 docker container rm -f $(docker container ps -aq) -q: print only container IDs

How to Setup LAMP Stack on Centos 7 - Right Way

This post shows how to setup a standard LAMP stack on CentOS 7. For the latest version of phpMyAdmin: 1 2 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* yum -y install epel-release For MariaDB: 1 2 3 yum -y install mariadb-server mariadb systemctl enable --now mariadb mysql_secure_installation For Apache: 1 2 yum -y install httpd systemctl enable --now httpd For PHP: 1 2 3 4 5 6 rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum -y install yum-utils yum update -y yum-config-manager --enable remi-php73 yum -y install php php-opcache systemctl restart httpd For making PHP work with MySQL:

How to Setup a Reverse Proxy with Nginx on Centos 7

Firstly, install nginx on the server. 1 2 3 yum update yum install epel-release yum install nginx Edit the nginx config file then. 1 2 cd /etc/nginx/nginx.conf vim nginx.conf Edit the file like this: 1 server_name domain.com; If you are not going to use a domain name, a public ip address would also work instead of domain.com 🙂 Find the location section in the file and replace it with: 1 2 3 4 5 6 7 8 location / { proxy_pass http://server_ip:8080; proxy_http_version 1.

How to Deploy Your Nodejs App on Centos 7

PM2 is a process manager for nodejs apps. It daemonizes apps built with nodejs, which means run-as-service. Let’s install PM2 using npm. 1 npm install -g pm2@latest Now you can start your app using pm2 like so: 1 pm2 start app.js Next, register the app as a startup process. 1 2 pm2 startup systemd pm2 save You can check the currently running apps like so: 1 pm2 list Remember your app name or id so that you can use it to restart or stop the service.

How to Configure Virtual Hosts on Centos 7 Apache Server

Prerequisites for a vhost setup: 1 chown -R apache:apache /path_to/site_root Set the permission of the project root directory to 755, you may already know. 🙂 Well, let’s create a vhost config file before you edit it. 1 2 cd /etc/httpd/conf.d vim domain_name.conf Now, grab this content to your config file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <VirtualHost *:80> ServerName domain.