enable-https
v1.0.3
Published
This package enables HTTPS for your site following Kolia Odnosumov's preferred setup.
Downloads
16
Readme
Enable HTTPS for Your Site
This package simplifies the process of enabling HTTPS on your site by following a preferred setup. It uses Nginx as a reverse proxy with SSL support and integrates Docker for easy SSL certificate generation via Certbot.
Key Features
- Adds necessary configuration files (
nginx/app.conf
,docker-compose.yml
) to your project. - Generates a secure
dhparam.pem
file locally. - Creates SSL certificates inside a Docker container using Certbot.
- Configures Nginx to automatically redirect all HTTP traffic to HTTPS.
How It Works
This package breaks the HTTPS setup process into two main steps:
1. Initial Setup
The package generates or updates the following files in your project:
docker-compose.yml
nginx/app.conf
dhparam.pem
You will need to run Docker Compose to finalize the initial setup and review the generated files.
2. Finalizing SSL Setup
After reviewing the configurations, the package will add SSL settings to nginx/app.conf
. Finally, you will need to restart your services to apply the changes.
By default, the package only performs the initial setup so you can review the configuration before enabling SSL.
Installation
Ensure you have Node.js installed. Then, install the package globally:
npm install -g enable-https
Usage
Run the following command to start the HTTPS setup process:
enable-https
By default, this will:
- Generate necessary configuration files (
docker-compose.yml
,nginx/app.conf
,dhparam.pem
). - Let you review the files before proceeding with SSL configuration.
Example Command
enable-https --domain example.com --email your-email@example.com --app-host myapp --app-port 4000
This command will generate SSL certificates for example.com
and configure the app with the provided host and port.
Options
-d, --domain <domains...>
: Specify the domains for SSL certificates (the first domain is the primary).-e, --email <email>
: Email address for Let's Encrypt notifications.-h, --app-host <host>
: Hostname of the application (default:"app"
).-p, --app-port <port>
: Application port (default:3000
).-f, --files-dir <directory>
: Directory for storing generated configuration files (default:"./enable-https-data"
).--app-public-dir-or-volume [directory-or-volume]
: Path to the public directory or volume (default:"app-public"
).--no-dhparam
: Skip generating thedhparam.pem
file.-2, --second-step
: Perform the second step (append SSL settings and restart services).
Finalizing the Setup
After reviewing the generated files, you can complete the SSL setup by running:
enable-https --second-step --domain example.com --email your-email@example.com --app-host myapp --app-port 4000
This will update nginx/app.conf
with the SSL configuration. You must restart your services for the changes to take effect.
License
This project is licensed under the MIT License.