From 15e2540fa6d80913d7be697a4b3e95f411a8dca8 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 20 Nov 2015 11:16:31 +0000
Subject: [PATCH] added config files for elasticsearch and phpCI

---
 elasticsearch.nginx.conf |  9 ++++++
 elasticsearch.repo       |  6 ++++
 gliders.nginx.conf       | 12 +++----
 install.sh               |  3 +-
 nginx.conf               |  5 +++
 phpci.nginx.conf         | 67 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 93 insertions(+), 9 deletions(-)
 create mode 100644 elasticsearch.nginx.conf
 create mode 100644 elasticsearch.repo
 create mode 100644 phpci.nginx.conf

diff --git a/elasticsearch.nginx.conf b/elasticsearch.nginx.conf
new file mode 100644
index 0000000..6deed80
--- /dev/null
+++ b/elasticsearch.nginx.conf
@@ -0,0 +1,9 @@
+server {
+    listen 80;
+    listen 8080;
+
+    server_name es.dev.gliders.vm;
+    location / {
+        proxy_pass http://127.0.0.1:9200;
+    }
+}
diff --git a/elasticsearch.repo b/elasticsearch.repo
new file mode 100644
index 0000000..e9d28a6
--- /dev/null
+++ b/elasticsearch.repo
@@ -0,0 +1,6 @@
+[elasticsearch-2.x]
+name=Elasticsearch repository for 2.x packages
+baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
+gpgcheck=1
+gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
+enabled=1
diff --git a/gliders.nginx.conf b/gliders.nginx.conf
index 681e7b2..e74f787 100644
--- a/gliders.nginx.conf
+++ b/gliders.nginx.conf
@@ -8,15 +8,11 @@ map $host $symfony_root {
     default /home/gliders/code/gliders-website;
 }
 
-upstream phpfcgi {
-    server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
-}
-
 server {
     listen 80;
     listen 8080;
 
-    server_name gliders.vm *.gliders.vm;
+    server_name gliders.vm dev.gliders.vm;
     root $symfony_root/web;
 
     error_log /var/log/nginx/gliders.error.log;
@@ -26,12 +22,12 @@ server {
     rewrite ^/app\.php/?(.*)$ /$1 permanent;
 
     location / {
-        index app.php;
+        index app_dev.php;
         try_files $uri @rewriteapp;
     }
 
     location @rewriteapp {
-        rewrite ^(.*)$ /app.php/$1 last;
+        rewrite ^(.*)$ /app_dev.php/$1 last;
     }
 
     # pass the PHP scripts to FastCGI server from upstream phpfcgi
@@ -78,4 +74,4 @@ server {
 #         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 #         fastcgi_param HTTPS on;
 #     }
-# }
\ No newline at end of file
+# }
diff --git a/install.sh b/install.sh
index e03bc3c..6bbd5c9 100644
--- a/install.sh
+++ b/install.sh
@@ -30,6 +30,7 @@ yum install python-inotify numpy python-matplotlib python-virtualenv
 python -m easy_install pip
 pip install pandas
 pip install css-html-js-minify
+pip install bcrypt
 
 # Install (& configure) sendmail
 yum install sendmail sendmail-cf m4
@@ -94,4 +95,4 @@ git clone git@gitlab.noc.soton.ac.uk:owanes/gliders-testwebsite.git
 
 # Restart (needed to get firewall to open ports for web, kernel might be
 # updated etc.)
-reboot
\ No newline at end of file
+reboot
diff --git a/nginx.conf b/nginx.conf
index 5a4af8d..3f9b19e 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -33,6 +33,11 @@ http {
     
     include             /etc/nginx/mime.types;
     default_type        application/octet-stream;
+    charset             utf-8;
+
+    upstream phpfcgi {
+        server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
+    }
 
     # Load modular configuration files from the /etc/nginx/conf.d directory.
     # See http://nginx.org/en/docs/ngx_core_module.html#include
diff --git a/phpci.nginx.conf b/phpci.nginx.conf
new file mode 100644
index 0000000..a4cd0e1
--- /dev/null
+++ b/phpci.nginx.conf
@@ -0,0 +1,67 @@
+# https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/
+# NOTE: This makes any .php file other than app, app_dev and config.php
+# downloadable. If you want one to run, add it to the "pass the PHP scripts to
+# upstream FCGI" location section below. Be careful adding PHP files with
+# sensitive data like passwords inside them.
+
+server {
+    listen 80;
+    listen 8080;
+
+    server_name phpci.dev.gliders.vm;
+    root /home/gliders/code/phpci/public;
+
+    error_log /var/log/nginx/phpci.error.log;
+    access_log /var/log/nginx/phpci.access.log;
+
+    location / {
+        try_files $uri @phpci;
+    }
+
+    # pass the PHP scripts to FastCGI server from upstream phpfcgi
+    location @phpci {
+        fastcgi_pass phpfcgi;
+        fastcgi_index index.php;
+        fastcgi_buffers 256 4k;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
+        fastcgi_param SCRIPT_NAME index.php;
+        fastcgi_param HTTPS off;
+    }
+}
+
+# We don't yet have an SSL cert (not like a VM on my own machine needs one...)
+# server {
+#     listen 443;
+# 
+#     server_name gliders.vm *.gliders.vm;
+#     root /home/gliders/code/gliders-website/web;
+# 
+#     ssl on;
+#     ssl_certificate /etc/ssl/certs/symfony2.crt;
+#     ssl_certificate_key /etc/ssl/private/symfony2.key;
+# 
+#     error_log /var/log/nginx/symfony2.error.log;
+#     access_log /var/log/nginx/symfony2.access.log;
+# 
+#     # strip app.php/ prefix if it is present
+#     rewrite ^/app\.php/?(.*)$ /$1 permanent;
+# 
+#     location / {
+#         index app.php;
+#         try_files $uri @rewriteapp;
+#     }
+# 
+#     location @rewriteapp {
+#         rewrite ^(.*)$ /app.php/$1 last;
+#     }
+# 
+#     # pass the PHP scripts to FastCGI server from upstream phpfcgi
+#     location ~ ^/(app|app_dev|config)\.php(/|$) {
+#         fastcgi_pass phpfcgi;
+#         fastcgi_split_path_info ^(.+\.php)(/.*)$;
+#         include fastcgi_params;
+#         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+#         fastcgi_param HTTPS on;
+#     }
+# }
-- 
GitLab