https://github.com/basemax/nginx-forwarding-script
A simple Node.js script for generating and managing Nginx forwarding configurations dynamically.
https://github.com/basemax/nginx-forwarding-script
bun javascript js microservice microservices nginx nginx-proxy nginx-proxy-manager nginx-reverse-proxy nginx-reverse-proxy-manager nginx-reverseproxy node ts typescript
Last synced: 3 months ago
JSON representation
A simple Node.js script for generating and managing Nginx forwarding configurations dynamically.
- Host: GitHub
- URL: https://github.com/basemax/nginx-forwarding-script
- Owner: BaseMax
- Created: 2025-02-24T13:46:33.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-07T13:55:40.000Z (4 months ago)
- Last Synced: 2025-03-07T17:47:06.781Z (4 months ago)
- Topics: bun, javascript, js, microservice, microservices, nginx, nginx-proxy, nginx-proxy-manager, nginx-reverse-proxy, nginx-reverse-proxy-manager, nginx-reverseproxy, node, ts, typescript
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nginx Forwarding Script
A simple Node.js script for generating and managing Nginx forwarding configurations dynamically.
## Features
- Automatically generates Nginx configuration files based on predefined routes.
- Supports multiple ports and route-based forwarding.
- Includes Cross-Origin Resource Sharing (CORS) headers.
- Manages existing configurations by overwriting outdated files.## Installation
### Prerequisites
- Node.js (Latest LTS recommended)
- Nginx installed and configured on your system### Clone the Repository
```sh
git clone https://github.com/BaseMax/nginx-forwarding-script.git
cd nginx-forwarding-script
```### Install Dependencies
```sh
bun install
```## Usage
### Configuration
Modify `src/configRoutes.ts` to define your forwarding rules. Example:
```ts
export const config: { ports: PortConfig[] } = {
ports: [
{
port: 9004,
gateway: '127.0.0.1:2004',
routes: [
{ method: 'POST', path: '/v1/member/register', target: '127.0.0.1:30031' },
{ method: 'POST', path: '/v1/login', target: '127.0.0.1:30031' }
]
}
]
};
```### Run the Script
```sh
bun run update
bun run reload
bun run restart
```This will generate the Nginx configuration files in the specified path and apply the forwarding rules.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Copyright
© 2025 Max Base.