A simple web server built with Rust and Actix-web that serves an HTML page on localhost with configurable port.
- 🚀 Built with Rust and Actix-web framework
- 🌐 Serves a beautiful HTML page with modern styling
- ⚙️ Configurable port via environment variable
- 📊 JSON API endpoint for status information
- 📁 Static file serving capability
- 🔧 Standard Rust build process
- Rust (latest stable version)
- Cargo (comes with Rust)
cargo buildDefault port (8080):
cargo runCustom port:
PORT=3000 cargo run- Main page: http://localhost:8080 (or your custom port)
- Status API: http://localhost:8080/api/status
- Static files: http://localhost:8080/static/
cargo build --release./target/release/example-rust-webPORT=9000 ./target/release/example-rust-webTo cross-compile for a different architecture, first install the target with rustup, then build with cargo build --target:
cargo build --release --target x86_64-unknown-linux-gnucargo build --release --target aarch64-unknown-linux-gnuThe resulting binary will be in target/<target-triple>/release/.
example-rust/
├── Cargo.toml # Project dependencies and metadata
├── src/
│ └── main.rs # Main application code
├── static/ # Static files directory (optional)
└── README.md # This file
GET /- Serves the main HTML pageGET /api/status- Returns JSON status informationGET /static/*- Serves static files from the static directory
PORT- Server port (default: 8080)
- actix-web - Web framework
- actix-files - Static file serving
- serde - Serialization/deserialization
- tokio - Async runtime
- chrono - Date and time utilities
- env_logger - Logging
This is an example project for educational purposes.