Skip to main content

Nginx Space

Nginx allows users to create an application using reverse proxy.

Create Nginx Space

In Create Space, select Nginx SDK to create a new Nginx application space. alt text

Initialization

After creation, the system automatically generates README and .gitattribute files for the user. At this point, the application space status is "Pending Initialization." The application space requires program files to run; for Nginx applications, you only need to add an nginx.conf file to configure the reverse proxy.

The following reference code configures a reverse proxy pointing to Baidu.

worker_processes  2;
user www-data;
events {
use epoll;
worker_connections 128;
}
error_log /var/log/nginx/error.log info;
http {
server_tokens off;
include mime.types;
charset utf-8;
access_log /var/log/nginx/access.log combined;
server {
listen 8000;
server_name localhost;

error_page 404 /custom_404.html; # Serve a static HTML page
location = /custom_404.html {
proxy_pass https://www.baidu.com;
}
location / {
proxy_pass https://www.baidu.com;
}
}
}

After submitting the nginx.conf file, the application space will automatically begin building the app. Once the build is complete, you can view the app's operational effects. You can modify the contents of nginx.conf to configure other reverse proxies. alt text