Skip to content

CodeWithSushil/TEMP-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TEMP Server

What is TEMP Server:-

  • This TEMP Server only for Android users or Termux users.
  • If you didn't know what is termux than you read here.
  • T for Termux App.
  • E for Nginx Web Server.
  • M for MariaDB Database Server.
  • P for PHP Language.

Termux Installation

  • If you install Termux app from Google Play Store maybe faced many problem in installation time.
  • So you go to download termux App from F-Droid or Github.
  • After install termux app than you follow this commands.

TEMP Server Installation Commands:-

  1. Update your Termux Repositorie.
 pkg update
     or
 apt update
  1. Update your Termux Packages.
pkg upgrade -y 
     or
apt upgrade -y
  1. Install PHP Language and PHP-FPM (FastCGI Process Manager) for PHP.
pkg install php php-fpm -y
            or
apt install php php-fpm -y
  1. Install MariaDB Database Server.
pkg install mariadb -y
         or
apt install mariadb -y
  1. Install Nginx Web Server.
pkg install nginx -y
        or
apt install nginx -y
  1. Install PhpMyAdmin for Mariadb/MySQL Client.
pkg install phpmyadmin -y
          or
apt install phpmyadmin -y
  1. Composer is a Dependency Manager for PHP programming language so if you need composer than go to this command.
pkg install composer -y
         or
apt install composer -y # (Optional)
  1. Install msmtp a lightweight SMTP (Simple Mail Transfer Protocol) client.
pkg install msmtp -y
       or 
apt install msmtp -y

PHP and Nginx Configuration

  • Set your project path
  • cd $PREFIX/etc/nginx edit nginx.conf file nano nginx.conf.
root /data/data/com.termux/files/usr/share/nginx/html;  #Default Set
# root /sdcard/your_project_path
index index.php index.html index.htm; # Set index
  • Configuration PHP Script and PHP-FPM.
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/data/data/com.termux/files/usr/var/run/php-fpm.sock;  # Set PHP-FPM for php script
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
  • Save nginx.conf file

PHP-FPM Configuration

  • Open php-fpm.d folder and edit www.conf file.
  • cd $PREFIX/etc/php-fpm.d and open www.conf file on nano text editor nano www.conf.
  • Set your user name if you didn't know than run this command whoami and copy your termux user name.
28 user = www-data   # Set your termux user name
29 group = www-data   # Set your termux user name
41 listen = /data/data/com.termux/files/usr/var/run/php-fpm.sock
53 listen.owner = www-data   # Set your termux user name
54 listen.owner = www-data   # Set your termux user name
116 pm = dynamic

PHP.ini Configuration

  • Go to lib directory cd $PREFIX/lib.
  • Create a php.ini file run this command touch php.ini.
  • Open php.ini file on your vim Editor or Nano Editor.
  • nano php.ini.
sendmail_path = "/data/data/com.termux/files/usr/bin/msmtp -C /data/data/com.termux/files/usr/etc/msmtprc -t"
  • Save your php.ini file.

MSMTP Configuration

  • First Create a .msmtprc file.
  • touch .msmtprc
  • Open .msmtprc file on your Nano Editor.
  • nano .msmtprc
account default
host smtp.mail.com
port 587
from      # Your Email id
auth on
user      # Your Email id
password  # Your Email Password
tls on
tls_starttls on
tls_trust_file /data/data/com.termux/files/usr/etc/tls/cert.pem
  • Save your .msmtprc file.

Check Configuration Status

  • Create a index.php file.
  • nano index.php
<?php
phpinfo();
?>
  • Run this command nginx and php-fpm.
nginx && php-fpm

TEMP Result