Skip to content

Instantly share code, notes, and snippets.

@prasetiyohadi
Last active December 23, 2015 09:52
Show Gist options
  • Save prasetiyohadi/2d8546d43d6f1075cf65 to your computer and use it in GitHub Desktop.
Save prasetiyohadi/2d8546d43d6f1075cf65 to your computer and use it in GitHub Desktop.
nginx proxy configuration for php-fpm, fastcgi, and kibana4
server {
listen 80;
server_name domain.com;
root /usr/share/nginx/html;
try_files $uri =404;
index index.php index.html;
location / {
}
location /blog {
return 301 http://domain.com/blogs;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location /blogs {
root /var/www/html;
try_files $uri $uri/ /index.php?$args;
index index.html index.php;
location ~ \.php$ {
try_files $uri = 404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
}
location /wiki {
root /var/www/html;
try_files $uri $uri/ /index.php?$args;
index index.html index.php;
location ~ \.php$ {
try_files $uri = 404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
}
location /ls/ {
gzip off;
include /etc/nginx/fastcgi_params;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/conf.d/ls.users;
root /var/www/html;
root /var/www/html;
fastcgi_index index.cgi;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location /kibana4/ {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/conf.d/kibana4.users;
rewrite ^/kibana4/(.*) /$1 break;
proxy_pass http://localhost:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment