Page MenuHomeDevCentral

D1251.id3214.diff
No OneTemporary

D1251.id3214.diff

diff --git a/pillar/webserver-legacy/sites.sls b/pillar/webserver-legacy/sites.sls
--- a/pillar/webserver-legacy/sites.sls
+++ b/pillar/webserver-legacy/sites.sls
@@ -51,6 +51,8 @@
web_php_sites:
www.dereckson.be:
+ domain: dereckson.be
+ subdomain: www
user: web-be-dereckson-www
source: wwwroot/dereckson.be/www
target: /var/wwwroot/dereckson.be/www
diff --git a/roles/webserver-legacy/php-sites/files/fastcgi-php.conf b/roles/webserver-legacy/php-sites/files/fastcgi-php.conf
new file mode 100644
--- /dev/null
+++ b/roles/webserver-legacy/php-sites/files/fastcgi-php.conf
@@ -0,0 +1,62 @@
+# -------------------------------------------------------------
+# Webserver
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/webserver-legacy/php-sites/files/fastcgi-php.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Path info
+#
+# try_files resets the $fastcgi_path_info variable.
+# Reference: http://trac.nginx.org/nginx/ticket/321
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+fastcgi_split_path_info ^(.+\.php)(/.+)$;
+try_files $fastcgi_script_name =404;
+
+set $path_info $fastcgi_path_info;
+fastcgi_param PATH_INFO $path_info;
+
+# -------------------------------------------------------------
+# Headers
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+fastcgi_param QUERY_STRING $query_string;
+fastcgi_param REQUEST_METHOD $request_method;
+fastcgi_param CONTENT_TYPE $content_type;
+fastcgi_param CONTENT_LENGTH $content_length;
+
+fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+fastcgi_param REQUEST_URI $request_uri;
+fastcgi_param DOCUMENT_URI $document_uri;
+fastcgi_param DOCUMENT_ROOT $document_root;
+fastcgi_param SERVER_PROTOCOL $server_protocol;
+fastcgi_param REQUEST_SCHEME $scheme;
+fastcgi_param HTTPS $https if_not_empty;
+
+fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+fastcgi_param REMOTE_ADDR $remote_addr;
+fastcgi_param REMOTE_PORT $remote_port;
+fastcgi_param SERVER_ADDR $server_addr;
+fastcgi_param SERVER_PORT $server_port;
+fastcgi_param SERVER_NAME $server_name;
+
+# -------------------------------------------------------------
+# Misc
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# Let's play nice with --enable-force-cgi-redirect PHP option
+fastcgi_param REDIRECT_STATUS 200;
+
+fastcgi_index index.php;
diff --git a/roles/webserver-legacy/php-sites/files/nginx-server.conf b/roles/webserver-legacy/php-sites/files/nginx-server.conf
new file mode 100644
--- /dev/null
+++ b/roles/webserver-legacy/php-sites/files/nginx-server.conf
@@ -0,0 +1,40 @@
+# -------------------------------------------------------------
+# Webserver
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Site: {{ fqdn }}
+# License: Trivial work, not eligible to copyright
+# Source file: roles/webserver-legacy/php-sites/files/nginx-server.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+server {
+ listen 80;
+ listen [::]:80;
+ server_name {{ fqdn }}
+
+ #include includes/ssl;
+ #ssl_certificate /usr/local/etc/letsencrypt/live/{{ certdir }}/fullchain.pem;
+ #ssl_certificate_key /usr/local/etc/letsencrypt/live/{{ certdir }}/privkey.pem;
+
+ root {{ root }};
+ index index.html index.php index.htm;
+
+ include includes/letsencrypt;
+
+ location / {
+ try_files $uri $uri/ =404;
+ }
+
+ location ~ \.php$ {
+ include includes/fastcgi-php.conf;
+ fastcgi_pass /var/run/web/{{ fqdn }}/php-fpm-pool.sock;
+ }
+
+}
diff --git a/roles/webserver-legacy/php-sites/init.sls b/roles/webserver-legacy/php-sites/init.sls
--- a/roles/webserver-legacy/php-sites/init.sls
+++ b/roles/webserver-legacy/php-sites/init.sls
@@ -9,3 +9,4 @@
- .account
- .files
- .php-fpm
+ - .nginx
diff --git a/roles/webserver-legacy/php-sites/nginx.sls b/roles/webserver-legacy/php-sites/nginx.sls
new file mode 100644
--- /dev/null
+++ b/roles/webserver-legacy/php-sites/nginx.sls
@@ -0,0 +1,36 @@
+# -------------------------------------------------------------
+# Salt — Provision PHP websites — php-fpm pools
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# FastCGI configuration for php-fpm
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ dirs.etc }}/nginx/includes/fastcgi-php.conf:
+ file.managed:
+ - source: salt://roles/webserver-legacy/php-sites/files/fastcgi-php.conf
+
+# -------------------------------------------------------------
+# Server block
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% for instance, site in pillar['web_php_sites'].iteritems() %}
+
+nginx_config_{{ instance }}:
+ file.managed:
+ - name: {{ dirs.etc }}/php-fpm.d/{{ instance }}.conf
+ - source: salt://roles/webserver-legacy/php-sites/files/php-fpm.conf
+ - template: jinja
+ - context:
+ fqdn: {{ instance }}
+ domain: {{ site['domain'] }}
+ subdomain: {{ site['subdomain'] }}
+ root: {{ site['target'] }}
+ certdir: {{ site['certdir']|default(instance) }}
+
+{% endfor %}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 07:58 (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259795
Default Alt Text
D1251.id3214.diff (6 KB)

Event Timeline