Hostname Configuration
Hostname Configuration with set_hostname Script¶
The set_hostname script is a utility provided with the application to help configure the necessary hostname parameters. This script ensures that the correct browser URL is set up for the application, including:
- Frontend Configuration: Ensures the browser can access the application.
- Backend Configuration: Allows proper routing of requests to the backend services.
- CORS (Cross-Origin Resource Sharing): Configures the application to handle requests from different origins securely.
Setting the hostname correctly is essential for users to access the application through their web browsers and for the application to handle requests and responses efficiently.
Purpose of the set_hostname Script¶
The set_hostname script specifically configures the browser URL for the application. This includes:
- Setting the protocol (HTTPS - required for secure communication).
- Setting the domain name or IP address.
- Configuring SSL certificates for secure connections.
This application requires HTTPS for secure communication. The set_hostname script will guide you through SSL certificate configuration.
SSL Certificate Options¶
During the hostname setup, you will be prompted to choose how to configure SSL certificates:
Certificate Configuration Options
Option 1: Provide Your Own SSL Certificate
- Choose this option if you have a valid SSL certificate from a Certificate Authority (CA) or Let's Encrypt.
- You will need to provide the paths to your certificate and private key files.
Option 2: Generate Self-Signed Certificate
- Choose this option if you don't have an SSL certificate.
- The script will automatically generate a self-signed certificate for you.
- Self-signed certificates are suitable for testing and internal use but will show a security warning in browsers.
Certificate Storage
All SSL certificates (both provided and self-signed) will be automatically stored in the router directory.
How to Use the set_hostname Script¶
Required Variable¶
When running the script, you will need the following variable:
- Hostname: This can be an IP address (e.g.,
192.168.1.100) or a DNS name (e.g.,example.com).
Steps to Run the Script¶
1. Run the Script: Use the following commands based on your operating system to execute the set_hostname script:
./config.sh set_hostname
./config.ps1 set_hostname
2. Provide the Hostname: When prompted, enter the hostname (IP or DNS) for the application.
3. Configure SSL Certificate: You will be asked: Do you want to provide your own SSL certificate? (y/n):
- If you answer
y: You will be prompted to provide paths to your certificate and private key files. - If you answer
n: A self-signed SSL certificate will be automatically generated and stored in therouterdirectory.
4. Verify Configuration: After running the script, ensure that:
- The hostname is correctly configured in the application's settings.
- SSL certificates are present in the router directory.
- The application is accessible via HTTPS at your configured hostname.