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
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?
https://play.google.com/store/apps/details?id=ru.kslabs.ksweb http://www.kswebserver.ru/
Servers Ultimate Pro, just 8 pounds. Include PHPAdmin, MySQL and ton of other servers. I am currently using it as proxy.
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
Atjeews android app server, small footprint, biggest advantage for me was jsp support.
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
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
If you find trouble to make it working, you can see this video : https://youtu.be/3_m3vNGTp74