Newer
Older
# Nginx Configuration
## Building and Running Docker Compose
1. Ensure Docker and Docker Compose are installed on your machine. If not, you can download them from the official Docker website.
2. Navigate to the directory containing the `docker-compose.yaml` file.
3. Build the Docker Compose file using the following command:
```sh
```
4. Run the Docker Compose file using the following command:
```sh
Based on the `nginx.conf` file, the following routes are available:
1. `/projet1`: This route proxies to `http://157.26.83.14:8081/projet1`.
2. `/projet2`: This route proxies to `http://157.26.83.14:8099/projet2`.
Please note that these routes are accessible via the domain `tic.ing.he-arc.ch` on port `443` (HTTPS).
## Add a New Route
To add a new route, you need to modify the `nginx/nginx.conf` file. The following is an example of how to add a new route:
```nginx
location /newproject {
proxy_pass http://XX.XX.XX.XX:XXXX/newproject;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
```
Then add the redirection on the `nginx/html/index.html` file.
```html
<a href="https://tic.ing.he-arc.ch/newproject">newproject</a>
```
Commit and push the changes to the repository. The CI/CD pipeline will automatically deploy the changes to the server.
If you are not using the CI/CD pipeline, you will need to build and run the Docker Compose file manually.
## Important Note
The SSL certificate and key are expected to be in the `/nginx/ssl/` directory. These files are ignored by Git as per the `.gitignore` file. Make sure to place your `bundle.crt` and `tic_ing.key` files in this directory.
## CI/CD config
To deploy the nginx container automatically, follow the instructions found [here](doc/setup-ci-cd.md).