فهرست منبع

Fixes #20: Add example of a complete nginx_vhosts entry with extra_parameters.

Jeff Geerling 10 سال پیش
والد
کامیت
a08f8cda11
2فایلهای تغییر یافته به همراه26 افزوده شده و 12 حذف شده
  1. 18 0
      README.md
  2. 8 12
      defaults/main.yml

+ 18 - 0
README.md

@@ -18,6 +18,24 @@ Available variables are listed below, along with default values (see `defaults/m
 
 A list of vhost definitions (server blocks) for Nginx virtual hosts. If left empty, you will need to supply your own virtual host configuration. See the commented example in `defaults/main.yml` for available server options. If you have a large number of customizations required for your server definition(s), you're likely better off managing the vhost configuration file yourself, leaving this variable set to `[]`.
 
+    nginx_vhosts:
+      - listen: "80 default_server"
+        server_name: "example.com"
+        root: "/var/www/example.com"
+        index: "index.php index.html index.htm"
+        error_page: ""
+        access_log: ""
+        extra_parameters: |
+          location ~ \.php$ {
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+            fastcgi_pass unix:/var/run/php5-fpm.sock;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            include fastcgi_params;
+          }
+
+An example of a fully-populated nginx_vhosts entry, using a `|` to declare a block of syntax for the `extra_parameters`.
+
     nginx_remove_default_vhost: false
 
 Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base `/` URL to be directed at one of your own virtual hosts configured in a separate .conf file.

+ 8 - 12
defaults/main.yml

@@ -22,25 +22,21 @@ nginx_proxy_cache_path: ""
 nginx_remove_default_vhost: false
 nginx_vhosts: []
 # Example vhost below, showing all available options:
-# - {
-#   listen: "80 default_server", # default: "80 default_server"
-#   server_name: "example.com", # default: N/A
-#   root: "/var/www/example.com", # default: N/A
-#   index: "index.html index.htm", # default: "index.html index.htm"
+# - listen: "80 default_server" # default: "80 default_server"
+#   server_name: "example.com" # default: N/A
+#   root: "/var/www/example.com" # default: N/A
+#   index: "index.html index.htm" # default: "index.html index.htm"
 #
 #   # Properties that are only added if defined:
-#   error_page: "",
-#   access_log: "",
+#   error_page: ""
+#   access_log: ""
 #   extra_parameters: "" # Can be used to add extra config blocks (multiline).
-# }
 
 nginx_upstreams: []
-# - {
-#   name: myapp1,
-#   strategy: "ip_hash", # "least_conn", etc.
+# - name: myapp1
+#   strategy: "ip_hash" # "least_conn", etc.
 #   servers: {
 #     "srv1.example.com",
 #     "srv2.example.com weight=3",
 #     "srv3.example.com"
 #   }
-# }