Web Server for Android

后端 未结 9 1071
鱼传尺愫
鱼传尺愫 2020-12-04 17:08

Is it possible to host a web server within an Android phone itself? Similar to Apache. I want to access the web server from the mobile browser itself.

Couldn\'t f

相关标签:
9条回答
  • 2020-12-04 17:18

    KSWEB — a suite for web development on the Android platform. It consists of: a web server, PHP programming language and the database MySQL. KSWEB allows you to organize a platform for running and debugging Web applications (sites) in your Android device. Working with the application is very simple. To start the server it is enough to run our application, select, if necessary, port and the root directory.

    By default, KSWEB contains a fully functional configuration file of the server, PHP and MySQL. However, if you want something to change them, go to the server options and click on the item «INI Files». Configuration files will be moved to SD-card of your device at «/mnt/sdcard/ksweb/ini/», if available. If repeatedly clicking on the item settings «INI Files» KSWEB will use the internal configuration files.

    What's in the plans?

    1. Review the requirements for the Android operating system, in particular reduce the requirements for the version of Android to run the application to 2.0;
    2. Add the ability to track the flow of errors arising when working with php and mysql;
    3. Move the log files on the server and mysql on sdcard;
    4. Extend the additional PHP libraries. For example, pdo_mysql;
    5. Move the database files to MySQL on sdcard.

    https://play.google.com/store/apps/details?id=ru.kslabs.ksweb http://www.kswebserver.ru/

    0 讨论(0)
  • 2020-12-04 17:21

    Servers Ultimate Pro, just 8 pounds. Include PHPAdmin, MySQL and ton of other servers. I am currently using it as proxy.

    0 讨论(0)
  • 2020-12-04 17:24

    Check KSWEB and Bit Web Server, both using Lighttpd als server, php and support mysql.

    i tried KSWEB, it works wonderfull, but i don't know yet how to use the modrewrite. but, it should be work. you can try the trial version of KSWEB before purchase it.

    KSWEB costs a little bit more than Bit Web Server only 0,XX $. if you decided to buy it, post your experience here... i want to know too... :)

    Bit Web Server

    KSWEB

    0 讨论(0)
  • 2020-12-04 17:25

    Atjeews android app server, small footprint, biggest advantage for me was jsp support.

    0 讨论(0)
  • 2020-12-04 17:33

    I might be a last to answer this question but believe me, this is the simplest and latest answer in 2020 for those who need to start a webserver in Android and need to serve multiple clients without implementing any other third-party libraries.

    Copy your HTML file into the assets folder of Android as server.html and declare the serverSocket as global in your class.

    Run the below code inside a new thread.

    try {
        serverSocket = new ServerSocket(8080);
        while (true) {
            final Socket socket = serverSocket.accept();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        BufferedReader is = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                        PrintWriter os = new PrintWriter(socket.getOutputStream(), true);
                        String request = is.readLine();
                        Scanner scanner = new Scanner(getAssets().open("server.html"));
                        String response = scanner.useDelimiter("\\Z").next();
                        os.print("HTTP/1.0 200" + "\r\n");
                        os.print("Content type: text/html" + "\r\n");
                        os.print("Content length: " + response.length() + "\r\n");
                        os.print("\r\n");
                        os.print(response + "\r\n");
                        os.flush();
                        socket.close();
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                }
            }).start();
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    

    That's all your native Android Java (no third-party libraries implemented) webserver is live at port 8080.

    If you want to use DB and POST requests, try to implement SQLite and WebSocket connections to make two-way communication.

    https://developer.android.com/reference/java/net/ServerSocket

    0 讨论(0)
  • 2020-12-04 17:34

    Till now I have seen all those applications are paid . And others doesn't have phpmyadmin. And I found finally one. You can have a look at kickweb server.

    Android web server PHP/MySQL/PHPMyAdmin

    Requirements

    • Internal memory should not be less than 50MB!
    • Minimum Android API 9 (GINGERBREAD)!

    Features

    • Lighttpd 1.4.34
    • PHP 5.5.9
    • MySQL 5.1.62
    • MSMTP 1.4.31
    • phpMyAdmin 4.1.10
    • Nginx 1.5.11

    Default Document Root (htdocs)

    • Path : /sdcard/htdocs/

    Default URL

    • Address : localhost:8080

    phpMyAdmin Informations

    • Address : localhost:10000
    • Username : root
    • Password :

    MySQL Informations

    • Host : localhost
    • Port : 3306
    • Username : root
    • Password :

    If you find trouble to make it working, you can see this video : https://youtu.be/3_m3vNGTp74

    0 讨论(0)
提交回复
热议问题