https://github.com/rnons/nginx-in-nix-shell-issue
Fix by pin to 19.03 HEAD
https://github.com/rnons/nginx-in-nix-shell-issue
Last synced: 3 months ago
JSON representation
Fix by pin to 19.03 HEAD
- Host: GitHub
- URL: https://github.com/rnons/nginx-in-nix-shell-issue
- Owner: rnons
- Created: 2019-07-18T06:09:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-20T13:40:43.000Z (almost 7 years ago)
- Last Synced: 2025-03-06T11:31:18.238Z (over 1 year ago)
- Language: HTML
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
I have a `nginx.conf` that looks like this
```
server {
listen 3000;
server_name ~^(?.+)\.localhost$;
root www/$sub;
}
```
And `www/hello/index.html` contains only `hello world` text.
The idea is `http://hello.localhost` will be served from `www/hello` directory. Using system-wide nginx works fine, however, when I run nginx in nix-shell, I get 500 error without any more error message.
## run nginx in nix-shell
```
nix-shell -p nginx --run "nginx -p . -c nginx.conf"
# or
nix-shell -I nixpkgs=http://github.com/NixOS/nixpkgs/archive/e199c174c69f196301de2ad2d5d87c76a822a558.tar.gz -p nginx --run "nginx -p . -c nginx.conf"
```
```
% curl hello.localhost:3000
500 Internal Server Error
500 Internal Server Error
nginx/1.16.0
```
## run system wide nginx
```
sudo nginx -p . -c nginx.conf
```
```
% curl hello.localhost:3000
hello world
```