Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access_log to stdout and error_log to stderr #23

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nginx-controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ EXPOSE 80 443

COPY nginx-ingress /
COPY nginx/ingress.tmpl /
COPY nginx/nginx.conf /etc/nginx/nginx.conf

RUN rm /etc/nginx/conf.d/*

Expand Down
2 changes: 1 addition & 1 deletion nginx-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {

resolver := getKubeDNSIP(kubeClient)
ngxc, _ := nginx.NewNGINXController(resolver, "/etc/nginx/", local)
ngxc.Start()
go ngxc.Start()
lbc, _ := controller.NewLoadBalancerController(kubeClient, 30*time.Second, *watchNamespace, ngxc)
lbc.Run()
}
Expand Down
33 changes: 33 additions & 0 deletions nginx-controller/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

daemon off;
user nginx;
worker_processes 1;

error_log stderr warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] $host "$request" '
'$status $body_bytes_sent $request_time "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /dev/stdout main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}
12 changes: 11 additions & 1 deletion nginx-controller/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,17 @@ func (nginx *NGINXController) Reload() {
// Start starts NGINX
func (nginx *NGINXController) Start() {
if !nginx.local {
shellOut("nginx")
command := exec.Command("nginx")
command.Stdout = os.Stdout
command.Stderr = os.Stderr
err := command.Start()
if err != nil {
glog.Fatalf("Error while starting nginx: %v", err)
}
err = command.Wait()
if err != nil {
glog.Fatalf("Error while waiting for nginx: %v", err)
}
}
}

Expand Down