PHP-FPM (FastCGI Process Manager) is an alternative implementation of PHP FastCGI. It provides some additional features like Adaptive process spawning which is useful for sites.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification:-
Os : Ubuntu 18.04.1 LTS Bionic Beaver 64Bit || Hostname: www.yourdomain.com || IP Address of Server:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -a ; getconf LONG_BIT
apt install -y apache2 php7.2 php7.2-common php7.2-cli php7.2-fpm
a2enmod proxy_fcgi setenvif rewrite ; a2enconf php7.2-fpm ; systemctl start apache2 ; systemctl enable apache2
gedit /etc/apache2/sites-available/000-default.conf &>/dev/null
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>
</VirtualHost>
apache2ctl configtest ; echo '<?php phpinfo(); ?>' > /var/www/html/info.php
systemctl restart php7.2-fpm apache2 ; systemctl status php7.2-fpm
http://127.0.0.1/info.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Method:2
apt install -y apache2 php7.2 php7.2-common php7.2-cli php7.2-fpm
a2enmod proxy_fcgi setenvif rewrite ; a2enconf php7.2-fpm ; systemctl start apache2 ; systemctl enable apache2
gedit /etc/apache2/sites-available/default-ssl.conf &>/dev/null
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>
apache2ctl configtest ; echo '<?php phpinfo(); ?>' > /var/www/html/info.php
systemctl restart php7.2-fpm apache2 ; systemctl status php7.2-fpm
http://127.0.0.1/info.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Optional Step: gedit /etc/php/7.2/fpm/php.ini &>/dev/null
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Optional Step:
Apache2 FastCGI Module install Manuall :-
apt install gdebi -y
wget http://mirrors.kernel.org/ubuntu/pool/multiverse/liba/libapache-mod-fastcgi/libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb
gdebi libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb
________________________________________________________________________________
Friday, December 17, 2021
How To Run Apache2 With PHP7.2-FPM On Ubuntu 18.04.1 LTS
How To Run Multiple Websites Using Nginx Webserver On Ubuntu 18.04 LTS
Sometimes it may be wise to run multiple websites or blogs on a single server. For example, running one website or blog per server may not be the best way to utilize your server resources. One server, one website? No way.. just not efficient.
That’s why there’s a feature called Virtual Hosts on Apache2 and Server Blocks on Nginx. Virtual hosts or server blocks are feature on these web servers that allow multiple websites and blogs to be hosted on a single server. If a server has enough resources, why wastes those resources by only hosting a single website?
This brief tutorial is going to show you how to enable server blocks on Nginx web server to host multiple blogs.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification:-
Os : Ubuntu 18.04 LTS Bionic Beaver
Hostname:- www.example.com
IP Address of Server:-192.168.213.232
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -a ; getconf LONG_BIT ; hostname -I ; hostname
apt-get install nginx -y
systemctl restart nginx ; systemctl enable nginx
mkdir -p /var/www/html/yourdomain.com/public_html ; mkdir -p /var/www/html/myexample.com/public_html
gedit /var/www/html/yourdomain.com/public_html/index.html &>/dev/null
<html>
<head>
<title>This is the yourdomain.com domain</title>
</head>
<body>
<p>This is yourdomain.com</p>
</body>
</html>
gedit /var/www/html/myexample.com/public_html/index.html &>/dev/null
<html>
<head>
<title>This is the myexample.com domain</title>
</head>
<body>
<p>This is myexample.com</p>
</body>
</html>
chown www-data:www-data /var/www/html ; chmod -R 755 /var/www/html
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/yourdomain.com
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/myexample.com
gedit /etc/nginx/sites-available/yourdomain.com &>/dev/null
server {
listen 80;
listen [::]:80;
root /var/www/html/yourdomain.com/public_html;
index index.html index.htm index.nginx-debian.html;
server_name www.yourdomain.com;
location / {
try_files $uri $uri/ =404;
}
}
gedit /etc/nginx/sites-available/myexample.com &>/dev/null
server {
listen 80;
listen [::]:80;
root /var/www/html/myexample.com/public_html;
index index.html index.htm index.nginx-debian.html;
server_name www.myexample.com;
location / {
try_files $uri $uri/ =404;
}
}
nginx -t ; rm /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/myexample.com /etc/nginx/sites-enabled/
systemctl restart nginx ; systemctl enable nginx
nano /etc/hosts
192.168.213.232 www.yourdomain.com
192.168.213.232 www.myexample.com
hostname -I
http://www.myexample.com
http://www.yourdomain.com
Optional steps
sudo nano /etc/nginx/nginx.conf
server_names_hash_bucket_size 64;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Optional steps
sudo nano /etc/nginx/nginx.conf
server_names_hash_bucket_size 64;
How To Set Up a Node.js Application for Production with pm2 Nginx on Ubuntu 18.04
Node.js is an open source Javascript runtime environment for easily building server-side and networking applications. The platform runs on Linux, OS X, FreeBSD, and Windows, and its applications are written in JavaScript. Node.js applications can be run at the command line but i will teach you how to run them as a service, so they will automatically restart on reboot or failure, so you can use them in a production environment.
Offcial website:- https://nodejs.org/en|| Github:- https://github.com/nodejs
Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. ||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification:-
Os : Ubuntu 18.04 LTS Bionic Beaver || Hostname:- www.example.com || IP Address of Server:-192.168.232.177
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -a ; getconf LONG_BIT
apt install -y build-essential curl gdebi aptitude git cmake net-tools software-properties-common leafpad nano synaptic vim wget libtool-bin autoconf automake python3-setuptools sqlite3 libtool-bin perl dpkg-dev python3-pip python3-dev libssl-dev checkinstall imagemagick openssl python libkrb5-dev nginx
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
bash nodesource_setup.sh
apt install nodejs -y
gedit hello.js &>/dev/null
const http = require('http');
const hostname = 'localhost';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World!\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
npm install pm2@latest -g --no-optional --no-shrinkwrap --no-package-lock
pm2 start hello.js
pm2 startup
systemctl enable pm2-root ; systemctl start pm2-root ; systemctl status pm2-root
pm2 save
nano /etc/nginx/conf.d/node.conf
server {
listen 80;
server_name www.testdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
nginx -t ; sudo netstat -tlpn | grep 3000 ; hostname -I ; systemctl restart nginx
sudo -- sh -c "echo 192.168.232.177 www.testdomain.com >> /etc/hosts"
http://www.testdomain.com
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to Setup install HTTP Git Server with Nginx on Debian 11
Git is an open-source version control system used by thousands of developers around the world.
HTTP Git Server is an open-source project that uses an Nginx webserver to serve Git repositories over your Local Area Network (LAN). It is very simple and easy to set up. Anyone can manage it from the command-line interface.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
𝐎𝐮𝐫 𝐒𝐞𝐫𝐯𝐞𝐫 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧:-
𝐎𝐬 : 𝐃𝐞𝐛𝐢𝐚𝐧 𝟏𝟏 𝐛𝐮𝐥𝐥𝐬𝐞𝐲𝐞 𝟔𝟒 𝐁𝐢𝐭 || 𝐇𝐨𝐬𝐭𝐧𝐚𝐦𝐞: || 𝐈𝐏 𝐀𝐝𝐝𝐫𝐞𝐬𝐬 𝐨𝐟 𝐒𝐞𝐫𝐯𝐞𝐫:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; getconf LONG_BIT ; hostname ; hostname -I
apt install -y build-essential net-tools curl git software-properties-common nginx git fcgiwrap apache2-utils unzip
mkdir /var/www/html/myrepo ; cd /var/www/html/myrepo ; mkdir user1.git
cd user1.git ; git --bare init
git update-server-info
chown -R www-data:www-data /var/www/html/myrepo ; chmod -R 755 /var/www/html/myrepo
htpasswd -c /var/www/html/myrepo/htpasswd user1
nano /etc/nginx/conf.d/git.conf
server {
listen 80;
root /var/www/html/myrepo;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name debian.example.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ (/.*) {
client_max_body_size 0;
auth_basic "Git Login";
auth_basic_user_file "/var/www/html/myrepo/htpasswd";
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /var/www/html/myrepo;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $1;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
nginx -t
systemctl restart nginx ; systemctl status nginx
mkdir project ; cd project ; git init
git config --global user.email "user1@yourdomain.com"
git config --global user.name "user1"
git remote add origin http://user1@debian.example.com/user1.git
mkdir dev01
echo "Subscribe share like " > dev01/file1
git add .
git commit -a -m "Add files and directories"
git push origin master
git clone http://user1@debian.example.com//user1.git
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Wednesday, December 15, 2021
Manjaro / Arch - How To Set Up Your FTP Server Vsftpd On Manjaro 21.2.0 Linux
Hi! The Tutorial Shows You Step-by-Step " How To Set Up Your FTP Server ( Vsftpd ) On Manjaro 21.2.0 Linux
vsftpd is the Very Secure File Transfer Protocol Daemon.
Manjaro Linux is a fast, user-friendly, desktop-oriented operating system based on Arch Linux.
𝐌𝐚𝐧𝐣𝐚𝐫𝐨 𝐇𝐨𝐦𝐞𝐩𝐚𝐠𝐞 - https://manjaro.org/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
𝐎𝐮𝐫 𝐒𝐞𝐫𝐯𝐞𝐫 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧-𝐎𝐬 : 𝐌𝗮𝗻𝗷𝗮𝗿𝗼 𝟐𝟏.𝟐.𝟎 (𝐐𝐨𝐧𝐨𝐬) 𝐗𝐅𝐂𝐄 𝟔𝟒 𝐁𝐢𝐭 𝗟𝗶𝗻𝘂𝘅 | 𝐇𝐨𝐬𝐭𝐧𝐚𝐦𝐞 : 𝐈𝐏 𝐚𝐝𝐝𝐫𝐞𝐬𝐬-
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; getconf LONG_BIT ; lsb_release -a
sudo pacman -S vsftpd
sudo nano /etc/vsftpd.conf
write_enable=YES
local_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
# add to the end : specify chroot directory
# if not specified, users' home directory equals FTP home directory
local_root=public_html
# turn off seccomp filter if cannot login normally
seccomp_sandbox=NO
nano /etc/vsftpd.chroot_list
# add users you allow to move over their home directory
manjaro
systemctl restart vsftpd ; systemctl status vsftpd
ftp://192.168.128.134
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------