TOS is usually accessed via domain names, and its service addresses change dynamically. For this reason, fixed IP addresses are not provided. However, certain industries may have security and compliance requirements that necessitate accessing TOS through fixed IP addresses. To meet these needs, you can set up an Nginx reverse proxy server on an Elastic Compute Service (ECS) instance. Then, you can access the objects in your TOS bucket via the public IP address of port 80 on the ECS instance. This gives you access to your TOS resources via a fixed IP address. This topic introduces the benefits and operational steps of accessing TOS through an ECS reverse proxy.
This method provides fixed IP addresses for accessing TOS and enhances data security with ECS's robust security features.
- Fixed IP addresses: Suitable for industries such as finance and healthcare that have security and compliance requirements necessitating access to TOS resources through fixed IP addresses.
- Enhanced data security: You can enable Web Application Firewall (WAF) or configure firewall policies for the ECS instance to make accessing TOS more secure.
- Logging: ECS serves as a unified access entry and records all TOS access logs, facilitating tracking and auditing.
tip
This section uses CentOS Stream Release 9 (64-bit) to show how to access TOS via an ECS reverse proxy.
Step 1: Open TCP port 80
By default, Nginx uses TCP port 80 for communication. To allow users to access this port, open it for the relevant security group of your ECS instance.
- In the left navigation pane, select Instances & Images > Instances.
- On the Instances page, click the instance you want to manage.
- On the instance details page, click the Security Group tab.
- In the Security Group Associated section, click Configure rule.
- On the Inbound rule tab, click Add rule.
- In the Add Inbound rule dialog, configure the following parameters.
- Once you have finished configuring, click Add.
Step 2: Obtain the public IP address
- In the left navigation pane, select Instances & Images > Instances.
- On the Instances page, click the instance you want to manage.
- Click the Network Interface tab to obtain the public IP address in the EIP Address column.
- Run this command to install Nginx.
- Run this command to open the configuration file, nginx.conf.
- Edit the HTTP module in the nginx.conf file. Save and exit once you have finished configuring it.
tip
- When you configure Nginx, the system disk generates access and error logs. To prevent excessive disk usage by these log files, which could lead to your cloud server performing poorly, we recommend regularly cleaning up disk space.
- The configuration method described in this section only supports proxying access to one bucket.
- Configure the following parameters in the nginx.conf file based on your situation:
- Run this command to check the syntax of the configuration.
- If correct, the command returns output containing text similar to the following:
- Run this command to restart the Nginx server and apply the configuration.
Step 4: Configure DNS resolution
This section uses Linux to demonstrate how to configure DNS resolution on the client side.
Run this command to open the hosts file.
To resolve the TOS domain name to the public IP address of the ECS instance, add the following to the end of the file:
Example:
Verifying the reverse proxy
- Run this command to assign execute (x) permission to tosutil.
- Run the config command to initialize the tosutil configuration.
tip
When initializing the tosutil configuration, set the -e parameter to https://<endpoint> if you are accessing the ECS instance via HTTPS.
- Run this command to upload an object to the bucket.
- On the ECS instance, run this command to view the Nginx access logs.
- If the access logs indicate that the upload request was forwarded through Nginx, then the ECS instance has been correctly set up with a reverse proxy for TOS.
-