mirror of
https://github.com/ditatompel/insights.git
synced 2025-01-08 03:12:06 +07:00
Compare commits
3 commits
d0d127c893
...
5c40b9fdd5
Author | SHA1 | Date | |
---|---|---|---|
5c40b9fdd5 | |||
3f36f5a14a | |||
46f0e51921 |
2 changed files with 20 additions and 20 deletions
|
@ -53,7 +53,7 @@ Sempurna sudah, semua fitur yang saya butuhkan terpenuhi oleh Nginx. Dan saatnya
|
||||||
|
|
||||||
{{< bs/alert info >}}
|
{{< bs/alert info >}}
|
||||||
{{< bs/alert-heading "INFO:" >}}
|
{{< bs/alert-heading "INFO:" >}}
|
||||||
Saya memiliki open-source project {{< bs/alert-link "ngx-kickstart" "https://github.com/ditatompel/ngx-kickstart" >}} (boilerplate) untuk mempermudah menginstall Nginx dari repositori officialnya dan mengkompile Nginx VTS module di FRESH Debian 12 atau Ubuntu 22.04 server.
|
Saya memiliki open-source project {{< bs/alert-link "nginx-kickstart" "https://github.com/ditatompel/nginx-kickstart" >}} (boilerplate) untuk mempermudah menginstall Nginx dari repositori officialnya dan mengkompile Nginx VTS module di FRESH Debian 12 atau Ubuntu 22.04 server.
|
||||||
{{< /bs/alert >}}
|
{{< /bs/alert >}}
|
||||||
|
|
||||||
## Installasi Nginx (Official Repo)
|
## Installasi Nginx (Official Repo)
|
||||||
|
@ -121,25 +121,25 @@ http {
|
||||||
|
|
||||||
## Mempersiapkan struktur direktori Nginx
|
## Mempersiapkan struktur direktori Nginx
|
||||||
|
|
||||||
Buat direktori `sites-available`, `sites-enabled`, `ssl`, `snippets` di dalam direktori `/etc/nginx` dengan menjalankan perintah:
|
Buat direktori `sites-available`, `sites-enabled`, `certs`, `snippets` di dalam direktori `/etc/nginx` dengan menjalankan perintah:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo mkdir -p /etc/nginx/{sites-available,sites-enabled,ssl,snippets}
|
sudo mkdir -p /etc/nginx/{sites-available,sites-enabled,certs,snippets}
|
||||||
```
|
```
|
||||||
|
|
||||||
Buat _self-signed certificate_ (hanya digunakan sebagai konfigurasi awal yang nantinya digantikan oleh `certbot`):
|
Buat _self-signed certificate_ (hanya digunakan sebagai konfigurasi awal yang nantinya digantikan oleh `certbot`):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo openssl req -x509 -newkey rsa:4096 -days 365 -nodes \
|
sudo openssl req -x509 -newkey rsa:4096 -days 365 -nodes \
|
||||||
-keyout /etc/nginx/ssl/privkey.pem \
|
-keyout /etc/nginx/certs/privkey.pem \
|
||||||
-out /etc/nginx/ssl/fullchain.pem \
|
-out /etc/nginx/certs/fullchain.pem \
|
||||||
-subj '/CN=example.local/O=My Organization/C=US'
|
-subj '/CN=example.local/O=My Organization/C=US'
|
||||||
```
|
```
|
||||||
|
|
||||||
Buat _DH-param_ dengan menjalankan perintah:
|
Buat _DH-param_ dengan menjalankan perintah:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
|
sudo openssl dhparam -out /etc/nginx/certs/dhparam.pem 2048
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cloudflare IP Trusted Proxy
|
## Cloudflare IP Trusted Proxy
|
||||||
|
@ -151,7 +151,7 @@ Buat _executable shell script_ `/etc/nginx/cloudflare-ips.sh` berikut:
|
||||||
```shell
|
```shell
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Nginx setup for cloudflare's IPs.
|
# Nginx setup for cloudflare's IPs.
|
||||||
# https://github.com/ditatompel/ngx-kickstart/blob/main/etc/nginx/cloudflare-ips.sh
|
# https://github.com/ditatompel/nginx-kickstart/blob/main/etc/nginx/cloudflare-ips.sh
|
||||||
# This is modified version of itsjfx's cloudflare-nginx-ips
|
# This is modified version of itsjfx's cloudflare-nginx-ips
|
||||||
# Ref of original script:
|
# Ref of original script:
|
||||||
# https://github.com/itsjfx/cloudflare-nginx-ips/blob/master/cloudflare-ips.sh
|
# https://github.com/itsjfx/cloudflare-nginx-ips/blob/master/cloudflare-ips.sh
|
||||||
|
@ -373,7 +373,7 @@ Configure dengan argumen yang sama dari output `nginx -V` diatas dan tambahkan `
|
||||||
_Build_, kemudian copy VTS module yang baru saja dicompile ke `/etc/nginx/modules/`:
|
_Build_, kemudian copy VTS module yang baru saja dicompile ke `/etc/nginx/modules/`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
make -j$(nproc)
|
make modules -j$(nproc)
|
||||||
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/
|
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -429,12 +429,12 @@ server {
|
||||||
|
|
||||||
## Konfigurasi Akhir
|
## Konfigurasi Akhir
|
||||||
|
|
||||||
Sebagai referensi konfigurasi akhir, silahkan lihat di repositori [https://github.com/ditatompel/ngx-kickstart/tree/main/etc/nginx](https://github.com/ditatompel/ngx-kickstart/tree/main/etc/nginx).
|
Sebagai referensi konfigurasi akhir, silahkan lihat di repositori [https://github.com/ditatompel/nginx-kickstart/tree/main/etc/nginx](https://github.com/ditatompel/nginx-kickstart/tree/main/etc/nginx).
|
||||||
|
|
||||||
## Kredit dan Referensi
|
## Kredit dan Referensi
|
||||||
|
|
||||||
- [https://nginx.org/en/linux_packages.html](https://nginx.org/en/linux_packages.html).
|
- [https://nginx.org/en/linux_packages.html](https://nginx.org/en/linux_packages.html).
|
||||||
- [https://github.com/vozlt/nginx-module-vts](https://github.com/vozlt/nginx-module-vts).
|
- [https://github.com/vozlt/nginx-module-vts](https://github.com/vozlt/nginx-module-vts).
|
||||||
- [https://github.com/itsjfx/cloudflare-nginx-ips](https://github.com/itsjfx/cloudflare-nginx-ips).
|
- [https://github.com/itsjfx/cloudflare-nginx-ips](https://github.com/itsjfx/cloudflare-nginx-ips).
|
||||||
- [https://github.com/ditatompel/ngx-kickstart](https://github.com/ditatompel/ngx-kickstart).
|
- [https://github.com/ditatompel/nginx-kickstart](https://github.com/ditatompel/nginx-kickstart).
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ It's perfect, all the features I need are met by Nginx. And it's time for me to
|
||||||
|
|
||||||
{{< bs/alert info >}}
|
{{< bs/alert info >}}
|
||||||
{{< bs/alert-heading "INFO:" >}}
|
{{< bs/alert-heading "INFO:" >}}
|
||||||
I have an open-source project called {{< bs/alert-link "ngx-kickstart" "https://github.com/ditatompel/ngx-kickstart" >}} (boilerplate) to make it easier to install Nginx from the official repository and compile the Nginx VTS module on a FRESH Debian 12 or Ubuntu 22.04 server.
|
I have an open-source project called {{< bs/alert-link "nginx-kickstart" "https://github.com/ditatompel/nginx-kickstart" >}} (boilerplate) to make it easier to install Nginx from the official repository and compile the Nginx VTS module on a FRESH Debian 12 or Ubuntu 22.04 server.
|
||||||
{{< /bs/alert >}}
|
{{< /bs/alert >}}
|
||||||
|
|
||||||
## Installing Nginx official repo
|
## Installing Nginx official repo
|
||||||
|
@ -121,25 +121,25 @@ http {
|
||||||
|
|
||||||
## Preparing the Nginx directory structure
|
## Preparing the Nginx directory structure
|
||||||
|
|
||||||
Create the `sites-available`, `sites-enabled`, `ssl`, `snippets` directories inside the `/etc/nginx` directory:
|
Create the `sites-available`, `sites-enabled`, `certs`, `snippets` directories inside the `/etc/nginx` directory:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo mkdir -p /etc/nginx/{sites-available,sites-enabled,ssl,snippets}
|
sudo mkdir -p /etc/nginx/{sites-available,sites-enabled,certs,snippets}
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a _self-signed_ certificate (only used as an initial configuration which will later be replaced by `certbot`):
|
Create a _self-signed_ certificate (only used as an initial configuration which will later be replaced by `certbot`):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo openssl req -x509 -newkey rsa:4096 -days 365 -nodes \
|
sudo openssl req -x509 -newkey rsa:4096 -days 365 -nodes \
|
||||||
-keyout /etc/nginx/ssl/privkey.pem \
|
-keyout /etc/nginx/certs/privkey.pem \
|
||||||
-out /etc/nginx/ssl/fullchain.pem \
|
-out /etc/nginx/certs/fullchain.pem \
|
||||||
-subj '/CN=example.local/O=My Organization/C=US'
|
-subj '/CN=example.local/O=My Organization/C=US'
|
||||||
```
|
```
|
||||||
|
|
||||||
Create _DH-param_ by running:
|
Create _DH-param_ by running:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
|
sudo openssl dhparam -out /etc/nginx/certs/dhparam.pem 2048
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cloudflare's IPs trusted proxy
|
## Cloudflare's IPs trusted proxy
|
||||||
|
@ -151,7 +151,7 @@ Create the following _executable shell script_ `/etc/nginx/cloudflare-ips.sh`:
|
||||||
```shell
|
```shell
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Nginx setup for cloudflare's IPs.
|
# Nginx setup for cloudflare's IPs.
|
||||||
# https://github.com/ditatompel/ngx-kickstart/blob/main/etc/nginx/cloudflare-ips.sh
|
# https://github.com/ditatompel/nginx-kickstart/blob/main/etc/nginx/cloudflare-ips.sh
|
||||||
# This is modified version of itsjfx's cloudflare-nginx-ips
|
# This is modified version of itsjfx's cloudflare-nginx-ips
|
||||||
# Ref of original script:
|
# Ref of original script:
|
||||||
# https://github.com/itsjfx/cloudflare-nginx-ips/blob/master/cloudflare-ips.sh
|
# https://github.com/itsjfx/cloudflare-nginx-ips/blob/master/cloudflare-ips.sh
|
||||||
|
@ -372,7 +372,7 @@ Configure with the same arguments from the `nginx -V` output above and add `--ad
|
||||||
Build, then copy the VTS module you just compiled to `/etc/nginx/modules/`:
|
Build, then copy the VTS module you just compiled to `/etc/nginx/modules/`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
make -j$(nproc)
|
make modules -j$(nproc)
|
||||||
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/
|
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -428,12 +428,12 @@ server {
|
||||||
|
|
||||||
## Final configuration
|
## Final configuration
|
||||||
|
|
||||||
As a final configuration reference, please look at [https://github.com/ditatompel/ngx-kickstart/tree/main/etc/nginx](https://github.com/ditatompel/ngx-kickstart/tree/main/etc/nginx).
|
As a final configuration reference, please look at [https://github.com/ditatompel/nginx-kickstart/tree/main/etc/nginx](https://github.com/ditatompel/nginx-kickstart/tree/main/etc/nginx).
|
||||||
|
|
||||||
## Credit and references
|
## Credit and references
|
||||||
|
|
||||||
- [https://nginx.org/en/linux_packages.html](https://nginx.org/en/linux_packages.html).
|
- [https://nginx.org/en/linux_packages.html](https://nginx.org/en/linux_packages.html).
|
||||||
- [https://github.com/vozlt/nginx-module-vts](https://github.com/vozlt/nginx-module-vts).
|
- [https://github.com/vozlt/nginx-module-vts](https://github.com/vozlt/nginx-module-vts).
|
||||||
- [https://github.com/itsjfx/cloudflare-nginx-ips](https://github.com/itsjfx/cloudflare-nginx-ips).
|
- [https://github.com/itsjfx/cloudflare-nginx-ips](https://github.com/itsjfx/cloudflare-nginx-ips).
|
||||||
- [https://github.com/ditatompel/ngx-kickstart](https://github.com/ditatompel/ngx-kickstart).
|
- [https://github.com/ditatompel/nginx-kickstart](https://github.com/ditatompel/nginx-kickstart).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue