Skip to content

Commit ef970fd

Browse files
committed
Document build failure workaround
1 parent e4a0e38 commit ef970fd

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is a rough outline of what a contributor's workflow looks like:
1414

1515
Example:
1616

17-
``` shell
17+
```terminal
1818
git remote add upstream https://github.com/glyn/nginx_robot_access.git
1919
git checkout -b my-new-feature main
2020
git commit -a
@@ -30,15 +30,17 @@ Many editors support that file natively. Others require a plugin, see https://ed
3030

3131
Be sure to run any tests:
3232

33-
``` shell
33+
```terminal
3434
cargo test
3535
```
3636

37+
With gcc v15 you may need to set the environment variable `CFLAGS="-Wno-error=unterminated-string-initialization"` to avoid a warning failing the build.
38+
3739
### Staying in sync with upstream
3840

3941
When your branch gets out of sync with the glyn/nginx_robot_access/main branch, use the following to update:
4042

41-
``` shell
43+
```terminal
4244
git checkout my-new-feature
4345
git fetch -a
4446
git pull --rebase upstream main

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,35 @@ This module is written in Rust. After [installing Rust](https://www.rust-lang.or
1515
the module may be built using `cargo`, but **must** be built for the version of NGINX that is in use.
1616

1717
For example, to build the module for NGINX version 1.22.1, issue the following command in the root directory of a clone of this repository:
18-
~~~
18+
19+
~~~terminal
1920
NGX_VERSION=1.22.1 cargo build --release
2021
~~~
2122

23+
With gcc v15 you may also need to set the environment variable `CFLAGS="-Wno-error=unterminated-string-initialization"` to avoid a warning failing the build.
24+
2225
This will build a shared library in `target/release`.
2326

2427
## Configuring
2528

2629
To enable this module, it must be loaded in the NGINX configuration, e.g.:
27-
~~~
30+
31+
~~~config
2832
load_module /var/lib/libnginx_robot_access.so;
2933
~~~
3034

3135
For this module to work correctly, the absolute file path of `robots.txt` must be configured in the NGINX configuration using the directive `robots_txt_path`. The directive takes a single argument: the absolute file path of `robots.txt`, e.g.:
32-
~~~
36+
37+
~~~config
3338
robots_txt_path /etc/robots.txt;
3439
~~~
3540

3641
The directive may be specified in any of the `http`, `server`, or `location` configuration blocks.
3742
Configuring the directive in the `location` block overrides any configuration of the directive in the `server` block. Configuring the directive in the `server` block overrides any configuration in the `http` block.
3843

3944
For example, here's a simple configuration that enables the module and sets the path to `/etc/robots.txt`:
40-
~~~
45+
46+
~~~config
4147
load_module /var/lib/libnginx_robot_access.so;
4248
...
4349
http {
@@ -54,14 +60,16 @@ http {
5460
## Validating
5561

5662
To make sure the module is working correctly, use `curl` to access your site and specify a user agent that your `robots.txt` file denies access for, e.g.:
57-
~~~
63+
64+
~~~terminal
5865
curl -A "GPTBot" https://example.org
5966
~~~
6067

6168
## Debugging
6269

6370
Some debug logging is included in the module. To use this, enable debug logging in the NGINX configuration, e.g.:
64-
~~~
71+
72+
~~~config
6573
error_log logs/error.log debug;
6674
~~~
6775

0 commit comments

Comments
 (0)