Back to Learning Tools

Web Development & Hosting

Termux पर Website बनाएं, Localhost चलाएं, और वेबसाइट होस्ट करें

1. Web Server Setup

Termux पर Web Server इनस्टॉल करें

PHP Server Setup:

$ pkg update && pkg upgrade
$ pkg install php
$ mkdir ~/mywebsite
$ cd ~/mywebsite
$ echo '<?php echo "Hello from Termux!"; ?>' > index.php
$ php -S 0.0.0.0:8080

📱 ब्राउज़र में: http://localhost:8080 खोलें

2. Node.js Server

Node.js से Express Server चलाएं

Express Server Setup:

$ pkg install nodejs npm
$ mkdir ~/nodeapp && cd ~/nodeapp
$ npm init -y
$ npm install express
$ cat > server.js <<'EOF'
const express = require("express");
const app = express();
const PORT = 3000;

app.get("/", (req, res) => {
  res.send("Hello from Termux Node.js!");
});

app.listen(PORT, "0.0.0.0", () => {
  console.log(`Server running on http://0.0.0.0:${PORT}`);
});
EOF
$ node server.js

3. Frontend Development

HTML, CSS, JavaScript फाइलें बनाएं

Project Structure:

mywebsite/ ├── index.html ├── styles.css ├── script.js └── assets/ ├── images/ └── fonts/

HTML Example (index.html):

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <title>My Website</title> </head> <body> <h1>Hello from Termux!</h1> <p>Building websites on Android.</p> <script src="script.js"></script> </body> </html>

4. Database Integration

MySQL, PostgreSQL, SQLite डेटाबेस का उपयोग करें

SQLite Setup:

$ pkg install sqlite
$ sqlite3 mydb.db
sqlite> CREATE TABLE users (id INTEGER, name TEXT);
sqlite> INSERT INTO users VALUES (1, 'John');
sqlite> SELECT * FROM users;

PHP में: new SQLite3('mydb.db')

5. Nginx Web Server

Professional Nginx Server चलाएं

Nginx Installation:

$ pkg install nginx
$ nginx
$ # Default location: $PREFIX/share/nginx/html
$ # Stop: nginx -s stop

6. Deployment & Hosting

वेबसाइट को ऑनलाइन होस्ट करें

🚀 Free Hosting Options:

  • GitHub Pages - Static websites के लिए free
  • Vercel - Next.js, React, Static sites
  • Netlify - Static & Jamstack hosting
  • Render - Free tier for web services
  • Replit - Online development & hosting

📦 Deploy from Termux:

$ pkg install git
$ git init
$ git add .
$ git commit -m "Initial commit"
$ git remote add origin https://github.com/username/repo.git
$ git push -u origin main

⚠️ Important Note

सिर्फ Educational Purpose के लिए सीखें। किसी भी Website को Hack करने की कोशिश न करें। सिर्फ अपनी वेबसाइट बनाएं और Hosting सीखें।