1, Reference documents:
- Part1 official documents
- Part 2 reference blog
- Termux advanced terminal installation, use and configuration tutorial (Guoguang boss)
- Android ROOT free deployment of private cloud (refer to Guoguang)
- Termux, Nginx+php+KodExplorer manage mobile phone files with browser
- nginx php configuration_ Play with Termux: teach you how to install php and nginx on your mobile phone (possibly from WX)
2, Trivial records:
How Termux is obtained:
Up to now, F-droid for Tsinghua source is a good acquisition channel. Through this channel, you can also easily obtain add on such as termux API, termux widget and termux boot.
How to change source:
In the newer version of Termux, the official provides a graphical interface (TUI) to semi automatically replace images. This method is recommended to avoid other risks. Execute the following command in Termux
The address of Tsinghua source is preset in the UI. Select and confirm. Generally, update automatically after confirmation. If not, update manually.
Install and start the SSH service:
You can also operate directly on the mobile phone screen without SSH, but the experience of small screen + touch keyboard is really poor.
- Install OpenSSH
pkg install openssh
- Set login password:
- Start SSH service process:
Since Huawei and other mainstream systems have strict restrictions on background processes, SSH connections are generally stopped after the screen is automatically closed. Therefore, you need to give Termux permissions such as "allow background activities" in settings such as "startup management" to maintain SSH connection.
Log in to Termux terminal from PC
- Check the ip address of the mobile phone in the Wifi settings of the mobile phone. Or directly query with ifconfig under Termux. Query user name: whoami. The above two items are used for SSH login.
Note that the port opened by openssh here is not 22, but 8022. pkg install an nmap, and then click nmap 127.0.0.1. You can see that a service called OA system is open on port 8022. Uh huh, I like it very much.
- SSH can be done directly on the terminal under Linux. You can also use Powershell under Win. If GUI tools are required, PuTTy/SecureCRT can be used. It's good to use Filezilla for Sftp. There are GUI tools under Linux/Win, which is more suitable for laymen and lazy people like me.
ssh XXX.XXX.XXX.XXX -p 8022
When logging in to Termux, you don't need to give a user name here. If you need to log in to a specific user, use the following command
ssh USER@XXX.XXX.XXX.XXX -p 8022
Set up web Environment
1.1 installation and configuration
Here, mainly refer to Part2.Item2 in the "reference documents" section. In the tutorial of Item1 Guoguang boss, some configurations need to be changed due to the change of PHP version. The time point of Item2 is 2021.5, and the time point I use is 2021.10. If there is a version change in the later stage, it can be modified by referring to the methods in Item2. The following is a reference:
**LAMP Construction of** Means Linux+Apache2+Mysql+PHP Although Guoguang actually gives a very simple use LNMP Method for deploying cloud in environment......As for my toss, "Because I want to" pkg install php pkg install mariadb pkg install apache2 pkg install php-apache After these installations are completed, you should check whether the service is running normally,But I don't want to write anymore... **to configure Apache analysis PHP** First, let's change the working directory: cd $PREFIX cd:change directory,$PREFIX yes termux Unique abbreviations,This is the directory: /data/data/com.termux/files/usr/ use vim Open profile: vim etc/apache2/httpd.conf vim It's a little troublesome for people like me who haven't used it,But it can be basically done by Baidu: Press esc go back to"Normal mode",In this mode, a is displayed in the lower right corner"that 's ok,column"Coordinates and the current progress of the cursor in the document. Cannot be entered,But it can be passed kjhl Complete the cursor up, down, left and right operations,More complex ones don't need to be pressed for the time being'i'get into"Input mode",Text is entered normally in this mode,Remember after entering'esc'Enter normal mode,You can't use the clipboard input of mobile phone input method here......Press':'get into"Command mode",The only commands I need are 'wq':Save and exit'q':Exit without saving,Use it when you're not sure if you typed something wrong'nyy'Copy this line and the following lines,n Is the number of rows,No n That's the line'ndd'Shear ditto'p'paste,Paste here is read vim Cache for,The clipboard of the phone input method cannot be read......Press'/'Enter search mode,Enter the content to retrieve,Remember to be case sensitive... first / Retrieve default home page,I remember correctly. It should be like this: <IfModule dir_module> DirectoryIndex index.html </IfModule> hold index.php Add to home page,So it becomes <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> Continue to retrieve the following two lines: LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so #LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so be careful#No. This indicates a comment. This line is not executed. Let's change the state of these two lines to this #LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so Under these two lines,Let's add it by the way PHP modular: LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> In Guoguang's tutorial here php7 modular php7_module,Loaded is libphp7.so,But I 2021-05-02 Yes during installation PHP8 Yes,Try according to the tutorial and report errors,use ls /data/data/com.termux/files/usr/libexec/apache2 Command found only one directory libphp.so file,Did you remind me after the change php7_module,Try it and change it to php_module As a result, I can run...That's it Then you can:wq Save and exit~ **test PHP** stay termux Get ready for the test,Copy and paste directly,A will be generated in the root directory of the website php Webpage: echo '<?php phpinfo(); ?>' > $PREFIX/share/apache2/default-site/htdocs/index.php start-up apache: apachectl start Then visit http://127.0.0.1:8080, you should be able to see a PHP information page At this point,Just finish all the preparations,Ready to install nextcloud Yes~
1.2 how to bind port 80 to web services under Termux
I have a little problem here. Whether Apache or Nginx is used, the default listen port is 8080. How to use port 80 instead? Record the attempt process as follows:
- Directly modify the Apache configuration file, listen 80, and then start the service. Error: insufficient permission to bind port 80. After using su to promote permissions, click the command prompt: not found
- After climbing the blog, it is determined that the environmental variables are not brought in. So su --help checks the parameters, selects several parameters for testing, and the results are invalid.
- Then I climbed the text and found that the su command of Termux can't take the past environment variable up to now. But it can be solved with the tsu command. After modifying the conf, start the service like this, and port 80 can bind.
pkg install tsu tsu apachectl
2. Installation and configuration of phpmyadmin
2.1 installing phpmyadmin under termux
Laymen love excitement. phpmyadmin is a must. First, copy the one in ANMPP and try it - it's an error. Sorry,My bad. If you can't act recklessly, then pkg install one:
pkg install phpmyadmin
The installation went well, but... How? Is that right?
Return not found
Github This page gives the answer: copy the entire directory of phpMyAdmin under the default installation location to the root directory of the Apache site. Visit 127.0.0.1/phpmyadmin to see the results.
- The default installation location is data/data/com.termux/files/usr/share/
- Apache site root directory data/data/com.termux/files/usr/share/apache2/default-site/htdocs/
At this point, phpadmin is ready for use.