- Get link
- X
- Other Apps
WINDOWS 10 / 11
OFFLINE SERVER
LOCALHOST
COMPLETE LOCAL OFFLINE WEB APPLICATION SERVER
A comprehensive guide to installing, configuring, operating and testing a complete local web application server without requiring an active internet connection.
Recommended stack: Laragon + Apache + PHP + MySQL/MariaDB + HTML + CSS + JavaScript.
01. LOCAL OFFLINE SERVER ARCHITECTURE
A local offline server runs web applications directly on your computer. The browser communicates with the local web server through the loopback address.
Core principle: The server and browser communicate within the same computer. Internet connectivity is not required for locally hosted application functionality.
02. RECOMMENDED TECHNOLOGY STACK
01. Apache
HTTP web server and request handling.
HTTP web server and request handling.
02. PHP
Backend processing and application logic.
Backend processing and application logic.
03. MySQL / MariaDB
Persistent database storage.
Persistent database storage.
04. phpMyAdmin
Database administration interface.
Database administration interface.
05. HTML / CSS
Frontend structure and presentation.
Frontend structure and presentation.
06. JavaScript
Browser interaction and dynamic behavior.
Browser interaction and dynamic behavior.
07. Node.js
Optional JavaScript backend runtime.
Optional JavaScript backend runtime.
08. VS Code
Application development editor.
Application development editor.
03. INSTALLATION AND DOWNLOAD
Recommended: Laragon Full Edition
Laragon provides a convenient Windows local development environment with web server and database management capabilities.
Step 1. Download the Windows 64-bit installer.
Step 2. Run the installer.
Step 3. Select C:\laragon as the installation directory.
Step 4. Enable Auto Virtual Hosts if desired.
Step 5. Complete the installation and launch Laragon.
Download and retain all required installers and dependencies before disconnecting from the internet.
04. SERVER CONFIGURATION
Default local addresses
| Service | Address |
|---|---|
| Local web server | localhost |
| Loopback IP | 127.0.0.1 |
| Apache | 127.0.0.1:80 |
| MySQL | 127.0.0.1:3306 |
| phpMyAdmin | localhost/phpmyadmin |
05. DIRECTORY STRUCTURE
Recommended Laragon project organization:
C:\laragon\
│
├── bin\
│ ├── apache\
│ ├── mysql\
│ ├── php\
│ └── nodejs\
│
├── data\
│ └── mysql\
│
├── etc\
├── usr\
├── tmp\
│
└── www\
│
├── my-application\
│ ├── app\
│ │ ├── controllers\
│ │ ├── models\
│ │ └── views\
│ │
│ ├── config\
│ ├── database\
│ ├── public\
│ │ ├── index.php
│ │ ├── css\
│ │ ├── js\
│ │ └── images\
│ │
│ ├── storage\
│ │ ├── logs\
│ │ └── uploads\
│ │
│ └── vendor\
│
├── my-blog\
├── my-dashboard\
└── my-api\
For security, configure the application document root to point to its public directory. Do not expose config, database backups or private application files through the browser.
06. CREATE YOUR FIRST PHP APPLICATION
Step 1: Create the project directory.
C:\laragon\www\my-application\
Step 2: Create index.php.
<?php
$server = "localhost";
$database = "local_app";
$username = "root";
$password = "";
$status = "OFFLINE SERVER READY";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>Local Offline Server</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f1f5f9;
padding: 40px;
text-align: center;
}
.container {
background: white;
padding: 30px;
border-radius: 12px;
max-width: 600px;
margin: auto;
}
h1 { color: #0891b2; }
.status {
color: #15803d;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>LOCAL WEB SERVER</h1>
<p class="status">
<?php echo $status; ?>
</p>
<p>PHP Version:
<?php echo PHP_VERSION; ?></p>
<p>Server:
<?php echo $_SERVER['SERVER_SOFTWARE']; ?></p>
<p>Current Time:
<?php echo date("Y-m-d H:i:s"); ?></p>
</div>
</body>
</html>
Step 3: Open the application in your browser.
LOCAL APPLICATION URL
http://localhost/my-application/
http://localhost/my-application/
07. MYSQL DATABASE CONFIGURATION
Create a database using phpMyAdmin or the SQL console.
CREATE DATABASE local_app
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
USE local_app;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) NOT NULL,
email VARCHAR(150),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (username, email)
VALUES ('admin', 'admin@localhost');
PHP database connection
<?php
$host = "127.0.0.1";
$db = "local_app";
$user = "root";
$pass = "";
try {
$pdo = new PDO(
"mysql:host=$host;dbname=$db;charset=utf8mb4",
$user,
$pass,
[
PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE =>
PDO::FETCH_ASSOC
]
);
} catch (PDOException $e) {
die("Database connection failed.");
}
Database communication workflow
08. TEST DATABASE CONNECTIVITY
<?php
require __DIR__ . '/config/database.php';
echo "DATABASE CONNECTION SUCCESSFUL";
$stmt = $pdo->query("SELECT * FROM users");
foreach ($stmt as $row) {
echo "<p>" . htmlspecialchars(
$row['username'],
ENT_QUOTES,
'UTF-8'
) . "</p>";
}
Save as database-test.php and navigate to:
http://localhost/my-application/database-test.php
09. LOCALHOST SECURITY CONFIGURATION
Restrict Apache and MySQL to the loopback interface to prevent access from other computers on the network.
Apache configuration
Listen 127.0.0.1:80 ServerName localhost:80
Example location:
C:\laragon\bin\apache\ httpd-2.4.x\conf\httpd.conf
MySQL configuration
[mysqld] bind-address=127.0.0.1
Example location:
C:\laragon\bin\mysql\ mysql-x.x\my.ini
Confirm that your configuration does not contain conflicting listener directives. Restart Apache and MySQL after changes. Restricting the bind address is more reliable than depending solely on a firewall rule.
Security layers
- Do not enable router port forwarding.
- Do not expose Apache to public networks.
- Use database authentication.
- Keep private files outside the public document root.
- Back up databases and application files.
10. STARTUP AND SHUTDOWN PROCEDURES
11. SERVER TESTING AND VERIFICATION
| Test | Method | Expected Result |
|---|---|---|
| Apache | Open localhost | Web page loads |
| PHP | Execute PHP file | PHP executes |
| MySQL | Connect using PDO | Successful connection |
| Database | SELECT query | Records returned |
| CSS | Load stylesheet | Styling works |
| JavaScript | Run JS function | Function executes |
| Offline | Disconnect internet | Local app continues working |
Command-line verification
php -v php -m netstat -ano | findstr :80 netstat -ano | findstr :3306 curl http://127.0.0.1/
Final offline test workflow
12. OFFLINE DEPENDENCY MANAGEMENT
External libraries and services must be replaced with locally stored resources if they are needed without internet access.
my-application/
│
└── public/
└── assets/
├── css/
│ └── bootstrap.min.css
│
├── js/
│ ├── bootstrap.bundle.min.js
│ └── jquery.min.js
│
├── fonts/
└── images/
Use local resource references
<link rel="stylesheet" href="assets/css/bootstrap.min.css"> <script src="assets/js/jquery.min.js"> </script>
Google Fonts, CDN libraries, external APIs and cloud authentication will not automatically work offline. Download permitted dependencies beforehand and test them with internet disconnected.
13. BACKUP AND RECOVERY
| Directory | Contents |
|---|---|
| C:\laragon\www | Web applications |
| C:\laragon\data | Database storage |
| C:\laragon\usr | User configuration |
Export databases as SQL files and maintain separate backups of applications and configuration. Do not rely on copying live database files as your only backup.
14. FINAL SYSTEM ARCHITECTURE
15. OFFICIAL DOCUMENTATION
FINAL RECOMMENDATION
Use Laragon Full + Apache + PHP 8.x + MySQL/MariaDB as the foundation for a complete Windows-based local offline web application server.
This environment can host multiple local applications, dashboards, databases, CMS platforms, document-management systems and custom web tools without requiring external hosting.
Comments