SAE requires code packages to follow a specific directory structure before deployment. This page covers how to create compliant packages for Java, PHP, Python, and .NET Core applications.
| Runtime | Package format | Key requirement |
|---|---|---|
| Java | JAR or WAR | No special structure required |
| PHP | ZIP | nginx/ and php/ must be at the ZIP root |
| Python | ZIP | Files must be at the ZIP root; no outer directory |
| .NET Core | ZIP | start.sh and build output must be at the ZIP root |
Java
Creating JAR or WAR packages for SAE is the same as standard Java packaging — no special steps required.
To deploy, see Deploy Java applications using WAR or JAR packages.
PHP
Packaging requirements
Your ZIP package must meet the following requirements:
The
nginx/andphp/directories must be at the root of the ZIP file — not nested inside a parent folder. If they are nested, SAE cannot locate the configuration files or entry point, and the deployment will fail.Replace the code files in
php/with your own application code.Modify the configuration files in
nginx/as needed.
Step 1: Download and extract the sample package
Download hello-sae-php.zip and extract it. The directory structure is:
.
├── nginx
│ ├── default.conf
│ ├── fastcgi_params
│ └── root.dir
└── php # Program directory
├── index.php # Entry point
└── phpinfo.phpStep 2: Replace your code and update the configuration
Replace the files in php/ with your own application code.
If your application uses non-default settings, update the nginx configuration:
| Configuration item | Default value | How to modify |
|---|---|---|
| Port | 80 | In default.conf, add listen <port>; (for example, listen 8080;) as the first line inside server{ }. |
| Entry point filename | index.php | In default.conf, update index index.php index.html index.htm; to index <your-entry-filename>; and update fastcgi_index index.php; to fastcgi_index <your-entry-filename>;. |
| Program directory name | php | In root.dir, update root /home/admin/app/php; to root /home/admin/app/<your-directory-name>;. |
Step 3: Package into a ZIP file
Package the contents of the current directory — not the directory itself — into a ZIP file:
zip -r my-php-app.zip nginx phpDo not include a parent folder. The nginx and php directories must appear at the root of the ZIP file.
Step 4: Deploy
Python
Packaging requirements
Your ZIP package must meet the following requirements:
Package the files and folders inside your project root — not the project root directory itself. If you include the outer directory, SAE cannot find your application files, and the deployment will fail.
If your application has a
requirements.txt, place it at the root of the ZIP file. SAE automatically installs software dependencies during deployment.
Step 1: Download and extract the sample package
Download hello-sae-python.zip. The sample depends on Flask, Gunicorn, and other packages listed in requirements.txt. The directory structure is:
.
├── app
│ └── hello.py
└── requirements.txt (optional; must be in the root directory)Step 2: Replace the sample with your application
Run the following commands to replace the sample code with your own:
# Download and extract the sample
wget https://sae-demo-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/demo/1.0/hello-sae-python.zip
unzip hello-sae-python.zip -d hello-sae-python && rm -rf hello-sae-python.zip && cd hello-sae-python
# Replace the sample code with your Python project
# Replace /path/to/your-python-project/ with your actual project path
rm -rf app/* requirements.txt
cp -r /path/to/your-python-project/. app/
cp -r /path/to/your-python-project/requirements.txt ./
# Package into a ZIP file
zip -r my-python-app.zip app requirements.txtStep 3: Deploy
.NET Core
Packaging requirements
Your ZIP package must meet the following requirements:
Package the files and folders inside your build output directory — not the directory itself. If you include the outer directory, SAE cannot locate the application files or startup script, and the deployment will fail.
If the application has a startup script (for example,
start.sh), place it at the root of the ZIP file. SAE automatically executes this script on deployment.
The ZIP file structure maps to the SAE instance as follows:
| ZIP path | SAE instance path | Description |
|---|---|---|
./start.sh | /home/admin/start.sh | Application startup script |
./your-dotnet-project | /home/admin/app/nginx/*.conf | .NET application files |
Step 1: Set up the .NET SDK
Download and install the .NET SDK. Select a .NET Core version supported by SAE, then verify the installation:
dotnet --versionIf the command returns an error, install the dependency packages listed in the error output.
Step 2: Build the project
Run the following commands from your project directory to restore dependencies and compile the source code:
# Navigate to your project directory
# Replace /path/to/your-dotnet-project/ with your actual project path
cd /path/to/your-dotnet-project/
# Restore project dependencies
dotnet restore
# Compile the source code
# -c Release: optimizes for production — improves runtime performance and strips debugging information
# -o demo: outputs the build artifacts to the demo/ directory
dotnet build -c Release -o demoStep 3: Write a startup script
Create a start.sh file in the build output directory, then make it executable:
chmod +x ./start.shStep 4: Review the directory structure
Verify the build output looks similar to the following before packaging:
.
├── appsettings.Development.json
├── appsettings.json
├── appsettings.Production.json
├── your-dotnet-project
...
└── start.shStep 5: Package into a ZIP file
Package all files in the current directory:
# demo.zip: the name of the ZIP file to create
# *: packages all files and folders in the current directory
zip -r demo.zip *