diff --git a/README.md b/README.md index 1d29dfa..63bdff0 100644 --- a/README.md +++ b/README.md @@ -1,311 +1,5 @@ -
-

πŸ‡ΊπŸ‡Έ English

- -# πŸš€ vServer - Functional Web Server on Go -> Full-featured web server with HTTP/HTTPS, MySQL, PHP support and GUI admin panel - -**πŸ‘¨β€πŸ’» Author:** Roman Sumaneev -**🌐 Website:** [voxsel.ru](https://voxsel.ru) -**πŸ“ž Contact:** [VK](https://vk.com/felias) - -## 🎯 Features - -Main page -Main page - -### 🌐 Web Server -- βœ… **HTTP/HTTPS** server with SSL certificate support -- βœ… **Proxy server** for request proxying -- βœ… **PHP server** with built-in PHP 8 support -- βœ… **Static content** for hosting websites -- βœ… **vAccess** - access control system for sites and proxies - -### πŸ—„οΈ Database -- βœ… **MySQL server** with full support - -### πŸ”§ Administration -- βœ… **GUI Admin Panel** - Wails desktop application with modern interface -- βœ… **Service Management** - start/stop HTTP, HTTPS, MySQL, PHP, Proxy -- βœ… **Site and Proxy Editor** - visual configuration management -- βœ… **vAccess Editor** - access rules configuration through interface - -## πŸ—οΈ Architecture - -``` -vServer/ -β”œβ”€β”€ 🎯 main.go # Main server entry point -β”‚ -β”œβ”€β”€ πŸ”§ Backend/ # Core logic -β”‚ β”‚ -β”‚ β”œβ”€β”€ admin/ # | πŸŽ›οΈ GUI Admin Panel (Wails) | -β”‚ β”‚ β”œβ”€β”€ go/ # | Go backend for admin panel | -β”‚ β”‚ └── frontend/ # | Modern UI | -β”‚ β”‚ -β”‚ β”œβ”€β”€ config/ # | πŸ”§ Go configuration files | -β”‚ β”œβ”€β”€ tools/ # | πŸ› οΈ Utilities and helpers | -β”‚ └── WebServer/ # | 🌐 Web server modules | -β”‚ -β”œβ”€β”€ 🌐 WebServer/ # Web content and configuration -β”‚ β”‚ -β”‚ β”œβ”€β”€ cert/ # | πŸ” SSL certificates | -β”‚ β”œβ”€β”€ soft/ # | πŸ“¦ MySQL and PHP | -β”‚ β”œβ”€β”€ tools/ # | πŸ“Š Logs and tools | -β”‚ └── www/ # | 🌍 Web content | -β”‚ -β”œβ”€β”€ πŸ“„ go.mod # Go modules -β”œβ”€β”€ πŸ”¨ build_admin.ps1 # Build GUI admin panel -└── πŸš€ vSerf.exe # GUI admin panel (after build) -``` - -## πŸš€ Installation and Launch - -### πŸ”¨ Building the Main Server -```powershell -./build_admin.ps1 -``` - -The script will automatically: -- Check/create `go.mod` -- Install dependencies (`go mod tidy`) -- Check/install Wails CLI -- Build the application β†’ `vSerf.exe` - -### πŸ“¦ Component Preparation -1. Extract `WebServer/soft/soft.rar` archive to `WebServer/soft/` folder -2. Run `vServer.exe` - main server -3. Run `vSerf.exe` - GUI admin panel for management - -> πŸ”‘ **Important:** Default MySQL password is `root` - -### πŸ“¦ Ready Project for Users -Required for operation: -- πŸ“„ `vSerf.exe` - GUI admin panel (optional) -- πŸ“ `WebServer/` - configuration and resources - -> πŸ’‘ The `Backend/` folder and `go.mod`, `main.go` files are only needed for development - -## βš™οΈ Configuration - -Configuration via `WebServer/config.json`: - -```json -{ - "Site_www": [ - { - "name": "Local Site", - "host": "127.0.0.1", - "alias": ["localhost"], - "status": "active", - "root_file": "index.html", - "root_file_routing": true - } - ], - "Proxy_Service": [ - { - "Enable": true, - "ExternalDomain": "git.example.com", - "LocalAddress": "127.0.0.1", - "LocalPort": "3333", - "ServiceHTTPSuse": false, - "AutoHTTPS": true - } - ], - "Soft_Settings": { - "mysql_port": 3306, "mysql_host": "127.0.0.1", - "php_port": 8000, "php_host": "localhost", - "proxy_enabled": true - } -} -``` - -**Main Parameters:** -- `Site_www` - website settings -- `Proxy_Service` - proxy service configuration -- `Soft_Settings` - service ports and hosts (MySQL, PHP, proxy_enabled) - -### 🌐 Alias with Wildcard Support - -Wildcard (`*`) support in aliases for sites: - -```json -{ - "alias": [ - "*.test.com", // All subdomains of test.com - "*.test.ru", // All subdomains of test.ru - "test.com", // Exact match - "api.*" // api with any zone - ], - "host": "test.com" -} -``` - -**Wildcard Examples:** -- `*.example.com` β†’ `api.example.com`, `admin.example.com`, `test.example.com` βœ… -- `example.*` β†’ `example.com`, `example.ru`, `example.org` βœ… -- `*example.com` β†’ `test-example.com`, `my-example.com` βœ… -- `*` β†’ any domain βœ… (use carefully!) -- `example.com` β†’ only `example.com` βœ… (without wildcard) - -### πŸ”„ Proxy Server - -The proxy server allows redirecting external requests to local services. - -**Proxy_Service Parameters:** -- `Enable` - enable/disable proxy (true/false) -- `ExternalDomain` - external domain for request interception -- `LocalAddress` - local service address -- `LocalPort` - local service port -- `ServiceHTTPSuse` - use HTTPS for connecting to local service (true/false) -- `AutoHTTPS` - automatically redirect HTTP β†’ HTTPS (true/false) - -**Multiple Proxy Example:** -```json -"Proxy_Service": [ - { - "Enable": true, - "ExternalDomain": "git.example.com", - "LocalAddress": "127.0.0.1", - "LocalPort": "3000", - "ServiceHTTPSuse": false, - "AutoHTTPS": true - }, - { - "Enable": false, - "ExternalDomain": "api.example.com", - "LocalAddress": "127.0.0.1", - "LocalPort": "8080", - "ServiceHTTPSuse": false, - "AutoHTTPS": false - } -] -``` - -#### πŸ“– Detailed Parameter Description: - -**`ServiceHTTPSuse`** - protocol for connecting to local service: -- `false` - vServer connects to local service via HTTP (default) -- `true` - vServer connects to local service via HTTPS - -**`AutoHTTPS`** - automatic HTTPS redirect: -- `true` - all HTTP requests are automatically redirected to HTTPS (recommended) -- `false` - both HTTP and HTTPS requests are allowed - -**How it Works:** -``` -Client (HTTP/HTTPS) β†’ vServer (AutoHTTPS check) β†’ Local Service (ServiceHTTPSuse) -``` - -**Applying Changes:** -- Enter `config_reload` command in console to reload configuration -- Changes will apply to new requests without server restart - -## πŸ”’ vAccess - Access Control System - -vServer includes a flexible access control system **vAccess** for sites and proxy services. - -### πŸ“ Configuration Locations - -**For Sites:** -``` -WebServer/www/{host}/vAccess.conf -``` - -**For Proxy:** -``` -WebServer/tools/Proxy_vAccess/{domain}_vAccess.conf -``` - -### βš™οΈ Main Features - -- βœ… **IP Filtering** - allow/block by IP addresses -- βœ… **Path Control** - restrict access to specific directories -- βœ… **File Filtering** - block by extensions (*.php, *.exe) -- βœ… **Exceptions** - flexible rules with exceptions_dir -- βœ… **Custom Errors** - redirects or error pages - -### πŸ“ Configuration Example - -```conf -# Allow admin panel only from local IPs -type: Allow -path_access: /admin/*, /api/admin/* -ip_list: 127.0.0.1, 192.168.1.100 -url_error: 404 - -# Block dangerous files in uploads -type: Disable -type_file: *.php, *.exe, *.sh -path_access: /uploads/* -url_error: 404 -``` - -### πŸ“š Documentation - -Detailed vAccess documentation: -- **For Sites:** see `WebServer/www/{host}/vAccess.conf` (examples in file) -- **For Proxy:** see `WebServer/tools/Proxy_vAccess/README.md` - -## πŸ“ Logging - -All logs are saved in `WebServer/tools/logs/`: - -- 🌐 `logs_http.log` - HTTP requests (including proxy P-HTTP) -- πŸ”’ `logs_https.log` - HTTPS requests (including proxy P-HTTPS) -- πŸ”„ `logs_proxy.log` - Proxy server errors -- πŸ—„οΈ `logs_mysql.log` - MySQL operations -- 🐘 `logs_php.log` - PHP errors -- βš™οΈ `logs_config.log` - Configuration -- πŸ” `logs_vaccess.log` - Access control for sites -- πŸ” `logs_vaccess_proxy.log` - Access control for proxy - -## πŸ” SSL Certificates - -### Certificate Installation - -1. Open `WebServer/` directory -2. Create `cert/` folder (if it doesn't exist) -3. Create a folder with your domain name or IP address -4. Place certificate files with **exact** names: - ``` - certificate.crt - private.key - ca_bundle.crt - ``` -5. Certificate will be automatically loaded at server startup - -### πŸ“ Certificate Structure - -``` -WebServer/ -└── cert/ - β”œβ”€β”€ example.com/ # Main domain - β”‚ β”œβ”€β”€ certificate.crt - β”‚ β”œβ”€β”€ private.key - β”‚ └── ca_bundle.crt - β”‚ - └── sub.example.com/ # Subdomain (optional) - β”œβ”€β”€ certificate.crt - β”œβ”€β”€ private.key - └── ca_bundle.crt -``` - -### 🎯 Working with Subdomains - -**Important:** If no separate folder is created in `cert/` for a subdomain, the parent domain's certificate will be used automatically. - -**Examples:** -- βœ… Request to `example.com` β†’ uses certificate from `cert/example.com/` -- βœ… Request to `sub.example.com` (folder exists) β†’ uses `cert/sub.example.com/` -- βœ… Request to `sub.example.com` (folder does NOT exist) β†’ uses `cert/example.com/` - -**This is convenient for wildcard certificates:** one certificate in the main domain folder is enough for all subdomains! 🌟 - -
- -
-

πŸ‡·πŸ‡Ί Русский

- # πŸš€ vServer - Π€ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½Ρ‹ΠΉ Π²Π΅Π±-сСрвСр Π½Π° Go +**πŸ‡ΊπŸ‡Έ [English version](README_EN.md)** > Π€ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½Ρ‹ΠΉ Π²Π΅Π±-сСрвСр с ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΎΠΉ HTTP/HTTPS, MySQL, PHP ΠΈ GUI-Π°Π΄ΠΌΠΈΠ½ΠΊΠΎΠΉ **πŸ‘¨β€πŸ’» Автор:** Π‘ΡƒΠΌΠ°Π½Π΅Π΅Π² Π ΠΎΠΌΠ°Π½ @@ -602,6 +296,4 @@ WebServer/ - βœ… Запрос ΠΊ `sub.example.com` (ΠΏΠ°ΠΏΠΊΠ° сущСствуСт) β†’ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ `cert/sub.example.com/` - βœ… Запрос ΠΊ `sub.example.com` (ΠΏΠ°ΠΏΠΊΠ° НЕ сущСствуСт) β†’ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ `cert/example.com/` -**Π­Ρ‚ΠΎ ΡƒΠ΄ΠΎΠ±Π½ΠΎ для wildcard-сСртификатов:** достаточно ΠΎΠ΄Π½ΠΎΠ³ΠΎ сСртификата Π² ΠΏΠ°ΠΏΠΊΠ΅ основного Π΄ΠΎΠΌΠ΅Π½Π° для всСх ΠΏΠΎΠ΄Π΄ΠΎΠΌΠ΅Π½ΠΎΠ²! 🌟 - -
\ No newline at end of file +**Π­Ρ‚ΠΎ ΡƒΠ΄ΠΎΠ±Π½ΠΎ для wildcard-сСртификатов:** достаточно ΠΎΠ΄Π½ΠΎΠ³ΠΎ сСртификата Π² ΠΏΠ°ΠΏΠΊΠ΅ основного Π΄ΠΎΠΌΠ΅Π½Π° для всСх ΠΏΠΎΠ΄Π΄ΠΎΠΌΠ΅Π½ΠΎΠ²! 🌟 \ No newline at end of file diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000..120e224 --- /dev/null +++ b/README_EN.md @@ -0,0 +1,300 @@ +# πŸš€ vServer - Functional Web Server on Go +**πŸ‡·πŸ‡Ί [Русская вСрсия](README.md)** +> Full-featured web server with HTTP/HTTPS, MySQL, PHP support and GUI admin panel + +**πŸ‘¨β€πŸ’» Author:** Roman Sumaneev +**🌐 Website:** [voxsel.ru](https://voxsel.ru) +**πŸ“ž Contact:** [VK](https://vk.com/felias) + +## 🎯 Features + +Main page +Main page + +### 🌐 Web Server +- βœ… **HTTP/HTTPS** server with SSL certificate support +- βœ… **Proxy server** for request proxying +- βœ… **PHP server** with built-in PHP 8 support +- βœ… **Static content** for hosting websites +- βœ… **vAccess** - access control system for sites and proxies + +### πŸ—„οΈ Database +- βœ… **MySQL server** with full support + +### πŸ”§ Administration +- βœ… **GUI Admin Panel** - Wails desktop application with modern interface +- βœ… **Service Management** - start/stop HTTP, HTTPS, MySQL, PHP, Proxy +- βœ… **Site and Proxy Editor** - visual configuration management +- βœ… **vAccess Editor** - access rules configuration through interface + +## πŸ—οΈ Architecture + +``` +vServer/ +β”œβ”€β”€ 🎯 main.go # Main server entry point +β”‚ +β”œβ”€β”€ πŸ”§ Backend/ # Core logic +β”‚ β”‚ +β”‚ β”œβ”€β”€ admin/ # | πŸŽ›οΈ GUI Admin Panel (Wails) | +β”‚ β”‚ β”œβ”€β”€ go/ # | Go backend for admin panel | +β”‚ β”‚ └── frontend/ # | Modern UI | +β”‚ β”‚ +β”‚ β”œβ”€β”€ config/ # | πŸ”§ Go configuration files | +β”‚ β”œβ”€β”€ tools/ # | πŸ› οΈ Utilities and helpers | +β”‚ └── WebServer/ # | 🌐 Web server modules | +β”‚ +β”œβ”€β”€ 🌐 WebServer/ # Web content and configuration +β”‚ β”‚ +β”‚ β”œβ”€β”€ cert/ # | πŸ” SSL certificates | +β”‚ β”œβ”€β”€ soft/ # | πŸ“¦ MySQL and PHP | +β”‚ β”œβ”€β”€ tools/ # | πŸ“Š Logs and tools | +β”‚ └── www/ # | 🌍 Web content | +β”‚ +β”œβ”€β”€ πŸ“„ go.mod # Go modules +β”œβ”€β”€ πŸ”¨ build_admin.ps1 # Build GUI admin panel +└── πŸš€ vSerf.exe # GUI admin panel (after build) +``` + +## πŸš€ Installation and Launch + +### πŸ”¨ Building the Main Server +```powershell +./build_admin.ps1 +``` + +The script will automatically: +- Check/create `go.mod` +- Install dependencies (`go mod tidy`) +- Check/install Wails CLI +- Build the application β†’ `vSerf.exe` + +### πŸ“¦ Component Preparation +1. Extract `WebServer/soft/soft.rar` archive to `WebServer/soft/` folder +2. Run `vServer.exe` - main server +3. Run `vSerf.exe` - GUI admin panel for management + +> πŸ”‘ **Important:** Default MySQL password is `root` + +### πŸ“¦ Ready Project for Users +Required for operation: +- πŸ“„ `vSerf.exe` - GUI admin panel (optional) +- πŸ“ `WebServer/` - configuration and resources + +> πŸ’‘ The `Backend/` folder and `go.mod`, `main.go` files are only needed for development + +## βš™οΈ Configuration + +Configuration via `WebServer/config.json`: + +```json +{ + "Site_www": [ + { + "name": "Local Site", + "host": "127.0.0.1", + "alias": ["localhost"], + "status": "active", + "root_file": "index.html", + "root_file_routing": true + } + ], + "Proxy_Service": [ + { + "Enable": true, + "ExternalDomain": "git.example.com", + "LocalAddress": "127.0.0.1", + "LocalPort": "3333", + "ServiceHTTPSuse": false, + "AutoHTTPS": true + } + ], + "Soft_Settings": { + "mysql_port": 3306, "mysql_host": "127.0.0.1", + "php_port": 8000, "php_host": "localhost", + "proxy_enabled": true + } +} +``` + +**Main Parameters:** +- `Site_www` - website settings +- `Proxy_Service` - proxy service configuration +- `Soft_Settings` - service ports and hosts (MySQL, PHP, proxy_enabled) + +### 🌐 Alias with Wildcard Support + +Wildcard (`*`) support in aliases for sites: + +```json +{ + "alias": [ + "*.test.com", // All subdomains of test.com + "*.test.ru", // All subdomains of test.ru + "test.com", // Exact match + "api.*" // api with any zone + ], + "host": "test.com" +} +``` + +**Wildcard Examples:** +- `*.example.com` β†’ `api.example.com`, `admin.example.com`, `test.example.com` βœ… +- `example.*` β†’ `example.com`, `example.ru`, `example.org` βœ… +- `*example.com` β†’ `test-example.com`, `my-example.com` βœ… +- `*` β†’ any domain βœ… (use carefully!) +- `example.com` β†’ only `example.com` βœ… (without wildcard) + +### πŸ”„ Proxy Server + +The proxy server allows redirecting external requests to local services. + +**Proxy_Service Parameters:** +- `Enable` - enable/disable proxy (true/false) +- `ExternalDomain` - external domain for request interception +- `LocalAddress` - local service address +- `LocalPort` - local service port +- `ServiceHTTPSuse` - use HTTPS for connecting to local service (true/false) +- `AutoHTTPS` - automatically redirect HTTP β†’ HTTPS (true/false) + +**Multiple Proxy Example:** +```json +"Proxy_Service": [ + { + "Enable": true, + "ExternalDomain": "git.example.com", + "LocalAddress": "127.0.0.1", + "LocalPort": "3000", + "ServiceHTTPSuse": false, + "AutoHTTPS": true + }, + { + "Enable": false, + "ExternalDomain": "api.example.com", + "LocalAddress": "127.0.0.1", + "LocalPort": "8080", + "ServiceHTTPSuse": false, + "AutoHTTPS": false + } +] +``` + +#### πŸ“– Detailed Parameter Description: + +**`ServiceHTTPSuse`** - protocol for connecting to local service: +- `false` - vServer connects to local service via HTTP (default) +- `true` - vServer connects to local service via HTTPS + +**`AutoHTTPS`** - automatic HTTPS redirect: +- `true` - all HTTP requests are automatically redirected to HTTPS (recommended) +- `false` - both HTTP and HTTPS requests are allowed + +**How it Works:** +``` +Client (HTTP/HTTPS) β†’ vServer (AutoHTTPS check) β†’ Local Service (ServiceHTTPSuse) +``` + +**Applying Changes:** +- Enter `config_reload` command in console to reload configuration +- Changes will apply to new requests without server restart + +## πŸ”’ vAccess - Access Control System + +vServer includes a flexible access control system **vAccess** for sites and proxy services. + +### πŸ“ Configuration Locations + +**For Sites:** +``` +WebServer/www/{host}/vAccess.conf +``` + +**For Proxy:** +``` +WebServer/tools/Proxy_vAccess/{domain}_vAccess.conf +``` + +### βš™οΈ Main Features + +- βœ… **IP Filtering** - allow/block by IP addresses +- βœ… **Path Control** - restrict access to specific directories +- βœ… **File Filtering** - block by extensions (*.php, *.exe) +- βœ… **Exceptions** - flexible rules with exceptions_dir +- βœ… **Custom Errors** - redirects or error pages + +### πŸ“ Configuration Example + +```conf +# Allow admin panel only from local IPs +type: Allow +path_access: /admin/*, /api/admin/* +ip_list: 127.0.0.1, 192.168.1.100 +url_error: 404 + +# Block dangerous files in uploads +type: Disable +type_file: *.php, *.exe, *.sh +path_access: /uploads/* +url_error: 404 +``` + +### πŸ“š Documentation + +Detailed vAccess documentation: +- **For Sites:** see `WebServer/www/{host}/vAccess.conf` (examples in file) +- **For Proxy:** see `WebServer/tools/Proxy_vAccess/README.md` + +## πŸ“ Logging + +All logs are saved in `WebServer/tools/logs/`: + +- 🌐 `logs_http.log` - HTTP requests (including proxy P-HTTP) +- πŸ”’ `logs_https.log` - HTTPS requests (including proxy P-HTTPS) +- πŸ”„ `logs_proxy.log` - Proxy server errors +- πŸ—„οΈ `logs_mysql.log` - MySQL operations +- 🐘 `logs_php.log` - PHP errors +- βš™οΈ `logs_config.log` - Configuration +- πŸ” `logs_vaccess.log` - Access control for sites +- πŸ” `logs_vaccess_proxy.log` - Access control for proxy + +## πŸ” SSL Certificates + +### Certificate Installation + +1. Open `WebServer/` directory +2. Create `cert/` folder (if it doesn't exist) +3. Create a folder with your domain name or IP address +4. Place certificate files with **exact** names: + ``` + certificate.crt + private.key + ca_bundle.crt + ``` +5. Certificate will be automatically loaded at server startup + +### πŸ“ Certificate Structure + +``` +WebServer/ +└── cert/ + β”œβ”€β”€ example.com/ # Main domain + β”‚ β”œβ”€β”€ certificate.crt + β”‚ β”œβ”€β”€ private.key + β”‚ └── ca_bundle.crt + β”‚ + └── sub.example.com/ # Subdomain (optional) + β”œβ”€β”€ certificate.crt + β”œβ”€β”€ private.key + └── ca_bundle.crt +``` + +### 🎯 Working with Subdomains + +**Important:** If no separate folder is created in `cert/` for a subdomain, the parent domain's certificate will be used automatically. + +**Examples:** +- βœ… Request to `example.com` β†’ uses certificate from `cert/example.com/` +- βœ… Request to `sub.example.com` (folder exists) β†’ uses `cert/sub.example.com/` +- βœ… Request to `sub.example.com` (folder does NOT exist) β†’ uses `cert/example.com/` + +**This is convenient for wildcard certificates:** one certificate in the main domain folder is enough for all subdomains! 🌟 +