I was able to get Nginx configured as a proxy to our Sharepoint WebApp server with the following config:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen *:80;
proxy_pass backend;
}
upstream backend {
server sharepoint:80;
}
}
That works great, but it still doesnt solve my problem.
I found an example config that appears to watch for a maintenance.html file and if detected returns the maintenance.html with a rewrite command. I figured I could use this in my config, and have my Solarwinds monitor run a script to copy the maintenance.html file to the designated path when it detects the site is down.
This is the example config I found, that I tried to integrate into my current config:
server {
listen 80;
server_name mysite.com;
root /var/www/mysite.com/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
... # the rest of your config goes here
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html break;
}
}
Now I am a total newbie with Nginx, so go easy on me if this is painfully obvious, but this is what I came up with when I attempted to integrate it into my current config:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen *:80;
root /etc/nginx/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html break;
}
proxy_pass backend;
}
upstream backend {
server connect:80;
}
}
I keep getting nginx: [emerg] "root" directive is not allowed here in /etc/nginx/nginx.conf :16 when trying to load the config. I've tried moving the root /etc/nginx/; directive around in the config, but I keep getting the same error, just with a different line identifier in the error code. Any help you can offer to get this working is greatly appreciated.
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen *:80;
proxy_pass backend;
}
upstream backend {
server sharepoint:80;
}
}
That works great, but it still doesnt solve my problem.
I found an example config that appears to watch for a maintenance.html file and if detected returns the maintenance.html with a rewrite command. I figured I could use this in my config, and have my Solarwinds monitor run a script to copy the maintenance.html file to the designated path when it detects the site is down.
This is the example config I found, that I tried to integrate into my current config:
server {
listen 80;
server_name mysite.com;
root /var/www/mysite.com/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
... # the rest of your config goes here
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html break;
}
}
Now I am a total newbie with Nginx, so go easy on me if this is painfully obvious, but this is what I came up with when I attempted to integrate it into my current config:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen *:80;
root /etc/nginx/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html break;
}
proxy_pass backend;
}
upstream backend {
server connect:80;
}
}
I keep getting nginx: [emerg] "root" directive is not allowed here in /etc/nginx/nginx.conf :16 when trying to load the config. I've tried moving the root /etc/nginx/; directive around in the config, but I keep getting the same error, just with a different line identifier in the error code. Any help you can offer to get this working is greatly appreciated.