### Start Spring Boot Application Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/java.md Examples of commands to start a Spring Boot application. These commands demonstrate basic startup, specifying configuration profiles, setting JVM parameters, and defining the server port. ```bash # Basic startup java21 -jar app.jar # Specify configuration file java21 -jar app.jar --spring.profiles.active=prod # Set JVM parameters java21 -Xms512m -Xmx1024m -jar app.jar # Specify port java21 -jar app.jar --server.port=8080 ``` -------------------------------- ### Start Command Examples for Go Projects Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/go.md Provides various examples of start commands for Go applications, including running compiled binaries, executing source files with specific Go versions, passing parameters, and setting environment variables. ```bash # Run compiled binary file ./myapp # Run with specified Go version go1.24 run main.go # Run with parameters ./myapp -port 8080 -config ./config.yaml # Set environment variables GIN_MODE=release ./myapp ``` -------------------------------- ### Express.js Hello World Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md A basic Express.js application that listens on port 3000 and responds with 'Hello World' to requests on the root path. Requires the `express` package to be installed. ```javascript const express = require('express'); const app = express(); app.get('/', (req, res) => { res.send('Hello World'); }); app.listen(3000); ``` -------------------------------- ### Spring Boot Configuration File Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/java.md An example of a Spring Boot `application.yml` configuration file. This demonstrates how to set the server port and configure database connection properties. ```yaml server: port: 8080 spring: datasource: url: jdbc:mysql://localhost:3306/mydb username: root password: your_password ``` -------------------------------- ### Website Creation and Management Source: https://context7.com/acepanel/acepanel.github.io/llms.txt This section outlines the workflow and configuration options for creating and managing websites within AcePanel. It covers prerequisites like installing Nginx and PHP, and details settings for PHP, static, and reverse proxy site types. Example for WordPress setup is also provided. ```bash # Website Creation Workflow (via Web UI): # 1. Navigate to Applications > Native Applications # - Install Nginx (or OpenResty) # - Install Percona/MySQL/MariaDB (for PHP sites) # 2. Navigate to Applications > Runtime Environment # - Install PHP 8.3+ (for PHP sites) # 3. Navigate to Website > PHP/Static/Reverse Proxy # - Click "Create Website" # Website Configuration Options: # - Name: Identifier (cannot change after creation) # - Domain: Your domain or server IP # - Root Directory: Leave empty for default /opt/ace/wwwroot/{name} # - PHP Version: Select installed version (PHP sites only) # - Database: Auto-create MySQL database (optional) # WordPress Example Setup: # 1. Create PHP website with database enabled # 2. Upload WordPress files to website directory via File Manager # 3. Configure rewrite rules (Edit > Rewrite > select "wordpress" preset) # 4. Enable HTTPS (Edit > HTTPS > Enable, select certificate) # 5. Access domain to complete WordPress installation ``` -------------------------------- ### Start Swoole HTTP Server Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/php.md Command to start a standalone Swoole HTTP server. This is a basic example for running custom Swoole applications. ```bash php84 server.php ``` -------------------------------- ### Install AcePanel with Shell Script Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/quickstart/install.md This snippet shows the command to initiate the AcePanel installation process. It downloads and executes a shell script from a provided URL. Ensure your server has internet access and the `curl` command is available. The installation should not be interrupted by closing the terminal. ```shell bash <(curl -sSLm 10 https://dl.acepanel.net/helper.sh) ``` -------------------------------- ### Custom Startup Script - Bash Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/general.md An example of a custom shell script for starting an application. It includes changing the directory, setting an environment variable, and then executing the application. The startup command to use this script is also provided. ```bash #!/bin/bash cd /opt/ace/project/myapp export ENV=production ./myapp ``` -------------------------------- ### Install AcePanel Source: https://context7.com/acepanel/acepanel.github.io/llms.txt Installs AcePanel on a clean Linux server using a single bash command. The script downloads and executes the installation helper. After installation, credentials and entry point are displayed, and the `acepanel info` command can be used to retrieve them. ```bash # Install AcePanel (run as root) bash <(curl -sSLm 10 https://dl.acepanel.net/helper.sh) # After installation, credentials are displayed: # ======================================== # AcePanel Installation Complete # Username: xxxxxxxx # Password: xxxxxxxxxxxxxxxx # Port: xxxxx # Entry: /xxxxxx # ======================================== # View panel info and credentials if forgotten acepanel info ``` -------------------------------- ### Run Node.js Application using npm Scripts Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md Starts a Node.js application by executing predefined scripts in the `package.json` file. This is a common practice for managing application start commands and build processes. ```bash # Use npm scripts npm24 start ``` ```bash # Use npm run npm24 run start:prod ``` -------------------------------- ### Run Node.js Application Directly Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md Executes a Node.js application directly using the `node` command. This is a basic way to start a Node.js server, often used for development or simple deployments. ```bash # Run directly node24 app.js ``` -------------------------------- ### Install Node.js Dependencies (Shell) Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/faq/project.md Installs project dependencies for a Node.js application using either npm or yarn. This is a common pre-start command. ```shell npm install ``` ```shell yarn ``` -------------------------------- ### Workerman HTTP Server Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/php.md A PHP script showing a basic Workerman HTTP server that sends 'Hello World' in response to requests. It requires the Workerman library to be installed via Composer. ```php onMessage = function($connection, $request) { $connection->send("Hello World"); }; Worker::runAll(); ``` -------------------------------- ### Install Python Dependencies (Shell) Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/faq/project.md Installs project dependencies for a Python application from a requirements file using pip. This is a common pre-start command. ```shell pip install -r requirements.txt ``` -------------------------------- ### Start Laravel Octane (Swoole) Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/php.md Command to start a Laravel Octane application using the Swoole server. It specifies the host and port for the application to listen on. ```bash php84 artisan octane:start --host=0.0.0.0 --port=8000 ``` -------------------------------- ### Echo Framework Hello World Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/go.md A basic 'Hello, World!' example using the Echo framework in Go. It sets up an HTTP server that listens on port 8080 and returns a plain text 'Hello' for the root path. Ensure the Echo framework is imported. ```go package main import ( "github.com/labstack/echo/v4" ) func main() { e := echo.New() e.GET("/", func(c echo.Context) error { return c.String(200, "Hello") }) e.Start(":8080") } ``` -------------------------------- ### Gin Framework Hello World Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/go.md A basic 'Hello, World!' example using the Gin framework in Go. It sets up a simple HTTP server that listens on port 8080 and responds with a JSON message for the root path. Ensure the Gin framework is imported. ```go package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.GET("/", func(c *gin.Context) { c.JSON(200, gin.H{"message": "Hello"}) }) r.Run(":8080") } ``` -------------------------------- ### Fiber Framework Hello World Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/go.md A basic 'Hello, World!' example using the Fiber framework in Go. It sets up an HTTP server that listens on port 8080 and sends a plain text 'Hello' for the root path. Ensure the Fiber framework is imported. ```go package main import "github.com/gofiber/fiber/v2" func main() { app := fiber.New() app.Get("/", func(c *fiber.Ctx) error { return c.SendString("Hello") }) app.Listen(":8080") } ``` -------------------------------- ### Install Node.js Dependencies using npm Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md Installs project dependencies using npm. Ensure Node.js is installed and the project source code is available. This command is typically run from the project's root directory. ```bash cd /opt/ace/project/myapp npm24 install ``` -------------------------------- ### Swoole HTTP Server Example Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/php.md A simple PHP script demonstrating how to create a basic Swoole HTTP server that responds with 'Hello World'. ```php on("request", function ($request, $response) { $response->header("Content-Type", "text/plain"); $response->end("Hello World"); }); $server->start(); ``` -------------------------------- ### Create Database Backups via Command Line Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/faq/database.md Provides command-line instructions for creating database backups for both MySQL and PostgreSQL. These commands allow for automated or manual backup creation. Replace 'username' and 'database_name' with your specific details. ```shell # MySQL mysqldump -u username -p database_name > backup.sql ``` ```shell # PostgreSQL pg_dump -U username database_name > backup.sql ``` -------------------------------- ### Retrieve AcePanel Information via CLI Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/quickstart/install.md This command is used to retrieve AcePanel's access information, such as username, password, and port, if they are forgotten. It's a utility command provided by the AcePanel installation. ```shell acepanel info ``` -------------------------------- ### Flask Startup Commands Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/python.md Provides commands to start a Flask application. Includes development server (not for production) and recommended Gunicorn configuration. ```bash # Development server (not recommended for production) /opt/ace/project/myapp/venv/bin/python app.py # Using Gunicorn (recommended) /opt/ace/project/myapp/venv/bin/gunicorn app:app -b 0.0.0.0:8000 -w 4 ``` -------------------------------- ### Django Startup Commands Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/python.md Provides commands to start a Django application. Includes development server (not for production) and recommended Gunicorn and uWSGI configurations. ```bash # Development server (not recommended for production) /opt/ace/project/myapp/venv/bin/python manage.py runserver 0.0.0.0:8000 # Using Gunicorn (recommended) /opt/ace/project/myapp/venv/bin/gunicorn myproject.wsgi:application -b 0.0.0.0:8000 -w 4 # Using uWSGI /opt/ace/project/myapp/venv/bin/uwsgi --http 0.0.0.0:8000 --module myproject.wsgi ``` -------------------------------- ### AcePanel API Request Example in Java Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/api.md This Java code demonstrates how to make an authenticated GET request to the AcePanel API. It includes functionality for generating HMAC-SHA256 signatures based on request details, timestamp, and a secret token. The example uses Java's built-in `HttpClient` and cryptographic libraries. ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.time.Instant; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.util.Base64; /** * AcePanel API Request Example (Java) */ public class AcePanelApiExample { public static void main(String[] args) { try { // Example request String apiUrl = "http://example.com/entrance/api/user/info"; String method = "GET"; String body = ""; // For GET requests, usually no request body int id = 16; String token = "YourSecretToken"; // Generate signature information SigningData signingData = signRequest(method, apiUrl, body, id, token); // Prepare HTTP request HttpClient client = HttpClient.newHttpClient(); HttpRequest.Builder requestBuilder = HttpRequest.newBuilder() .uri(URI.create(apiUrl)) .header("Content-Type", "application/json") .header("X-Timestamp", String.valueOf(signingData.timestamp)) .header("Authorization", "HMAC-SHA256 Credential=" + signingData.id + ", Signature=" + signingData.signature); // Set request method and body if (method.equals("GET")) { requestBuilder.GET(); } else { requestBuilder.method(method, HttpRequest.BodyPublishers.ofString(body)); } HttpRequest request = requestBuilder.build(); // Send request HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); // Output results System.out.println("Response Status Code: " + response.statusCode()); System.out.println("Response Content: " + response.body()); } catch (Exception e) { e.printStackTrace(); } } static class SigningData { long timestamp; String signature; int id; SigningData(long timestamp, String signature, int id) { this.timestamp = timestamp; this.signature = signature; this.id = id; } } public static SigningData signRequest(String method, String url, String body, int id, String token) throws Exception { // Parse URL URI uri = new URI(url); String path = uri.getPath(); String query = uri.getQuery() != null ? uri.getQuery() : ""; // Canonical path String canonicalPath = path; if (!path.startsWith("/api")) { int apiPos = path.indexOf("/api"); if (apiPos != -1) { canonicalPath = path.substring(apiPos); } } // Calculate SHA256 hash of request body String bodySha256 = sha256Hash(body != null ? body : ""); // Construct canonical request String canonicalRequest = String.join("\n", method, canonicalPath, query, bodySha256); // Get current timestamp long timestamp = Instant.now().getEpochSecond(); // Construct string to sign String stringToSign = String.join("\n", "HMAC-SHA256", String.valueOf(timestamp), sha256Hash(canonicalRequest)); // Calculate signature String signature = hmacSha256(token, stringToSign); // Return signature and timestamp return new SigningData(timestamp, signature, id); } private static String sha256Hash(String text) throws Exception { MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(text.getBytes(StandardCharsets.UTF_8)); return bytesToHex(hash); } private static String hmacSha256(String key, String message) throws Exception { Mac mac = Mac.getInstance("HmacSHA256"); SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); mac.init(secretKeySpec); byte[] hash = mac.doFinal(message.getBytes(StandardCharsets.UTF_8)); return bytesToHex(hash); } private static String bytesToHex(byte[] bytes) { StringBuilder hexString = new StringBuilder(); for (byte b : bytes) { String hex = Integer.toHexString(0xff & b); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); } } ``` -------------------------------- ### Set Environment Variables for Node.js Application Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md Starts a Node.js application with specific environment variables set. This is useful for configuring application behavior, such as setting the Node environment or specifying a port. ```bash # Set environment variables NODE_ENV=production node24 app.js ``` ```bash # Specify port PORT=3000 node24 app.js ``` -------------------------------- ### Gunicorn Startup Command with Config Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/python.md Starts Gunicorn using a specified configuration file. This allows for more control over the server's behavior. ```bash /opt/ace/project/myapp/venv/bin/gunicorn -c gunicorn.conf.py myproject.wsgi:application ``` -------------------------------- ### Increase Node.js Memory Limit Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/nodejs.md Starts a Node.js application with an increased memory limit. This is useful for applications that consume a large amount of memory and might otherwise crash due to out-of-memory errors. ```bash NODE_OPTIONS="--max-old-space-size=4096" node24 app.js ``` -------------------------------- ### Build Go Project (Shell) Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/faq/project.md Compiles a Go project. This is a common pre-start command for Go applications. ```shell go build ``` -------------------------------- ### Node.js API Client for User Info Source: https://context7.com/acepanel/acepanel.github.io/llms.txt This Node.js example shows how to sign and make an API request for user information using HMAC-SHA256. It includes helper functions for SHA256 hashing and HMAC generation, and uses the 'axios' library for HTTP requests. Ensure 'axios' is installed. ```javascript // Node.js API Client Example const crypto = require('crypto'); const axios = require('axios'); function sha256Hash(text) { return crypto.createHash('sha256').update(text || '').digest('hex'); } function hmacSha256(key, message) { return crypto.createHmac('sha256', key).update(message).digest('hex'); } function signRequest(method, apiUrl, body, id, token) { const parsedUrl = new URL(apiUrl); let canonicalPath = parsedUrl.pathname; const query = parsedUrl.search.slice(1); if (!canonicalPath.startsWith('/api')) { const apiPos = canonicalPath.indexOf('/api'); if (apiPos !== -1) canonicalPath = canonicalPath.slice(apiPos); } const canonicalRequest = [method, canonicalPath, query, sha256Hash(body || '')].join('\n'); const timestamp = Math.floor(Date.now() / 1000); const stringToSign = ['HMAC-SHA256', timestamp, sha256Hash(canonicalRequest)].join('\n'); const signature = hmacSha256(token, stringToSign); return { timestamp, signature, id }; } // Example usage const signingData = signRequest('GET', 'http://example.com/entrance/api/user/info', '', 16, 'YourSecretToken'); axios({ method: 'GET', url: 'http://example.com/entrance/api/user/info', headers: { 'Content-Type': 'application/json', 'X-Timestamp': signingData.timestamp, 'Authorization': `HMAC-SHA256 Credential=${signingData.id}, Signature=${signingData.signature}` } }).then(res => console.log(res.data)); ``` -------------------------------- ### Docker Container Management Source: https://context7.com/acepanel/acepanel.github.io/llms.txt This guide details how to install Docker and manage containers and compose stacks within AcePanel. It covers container creation options, port mapping, volume mounts, environment variables, and deploying applications like pgAdmin 4 using compose templates. Common container operations are also listed. ```bash # Install Docker (via Web UI): # Navigate to Applications > Native Applications > Docker > Install # Container Creation Options: # - Container Name: Optional, auto-generated if empty # - Image: e.g., nginx, mysql:8.4, username/image:tag # - Network: Select container network # - Restart Policy: none | always | on-failure | unless-stopped # - Port Mapping: host_port:container_port (e.g., 8080:80) # - Volume Mounts: host_path:container_path (e.g., /opt/ace/data:/data) # - Environment Variables: KEY=VALUE format # Compose Template Deployment (pgAdmin 4 Example): # 1. Navigate to Applications > Container Templates # 2. Find pgAdmin 4, click "Deploy" # 3. Select "Create New Compose" # 4. Configure: # - Compose Name: pg4admin # - Auto Start: checked # - Auto Firewall: checked # - Access Port: 999 # - Admin Email/Password: your credentials # 5. Click Next > Create # 6. Access http://ServerIP:999 # Container Operations: # - Terminal: Execute commands inside container # - Logs: View runtime logs # - Batch: Start/Stop/Restart/Delete multiple containers # - Clean: Remove all stopped containers ``` -------------------------------- ### FastAPI Startup Commands Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/python.md Provides commands to start a FastAPI application using Uvicorn or Gunicorn with Uvicorn workers. ```bash # Using Uvicorn /opt/ace/project/myapp/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000 # Using Gunicorn + Uvicorn Workers (recommended) /opt/ace/project/myapp/venv/bin/gunicorn main:app -b 0.0.0.0:8000 -w 4 -k uvicorn.workers.UvicornWorker ``` -------------------------------- ### Check and Start AcePanel Service Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/faq/panel.md Commands to check the status of the AcePanel service and start it if it has stopped. This is a primary step for troubleshooting panel inaccessibility. ```shell acepanel status acepanel start ``` -------------------------------- ### Start Workerman Application Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/project/php.md Command to start a Workerman application. Workerman is a high-performance asynchronous socket framework for PHP. ```bash php84 start.php start ``` -------------------------------- ### Build Frontend Projects for Static Deployment Source: https://github.com/acepanel/acepanel.github.io/blob/main/en/advanced/website/static.md Commands to build frontend projects (Vue, React) for deployment as static websites. This typically involves running a build script and uploading the output to a specified website directory. ```bash # Vue project npm run build # Upload dist directory contents to website directory # React project npm run build # Upload build directory contents to website directory ```