wordpress-vhost-nginx
Example:
# Nginx wordpress vhost config. - wordpress-vhost-nginx: vhost_name: my_wordpress_site wp_title: My wordpress site use_https: true host: dev.frkl.io base_path: /var/www/wordpress
Description
Create Nginx wordpress virtual host config.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The name of the wordpress instance. Required |
|
string | /var/www | The wordpress project folders parent directory. |
|
boolean | False | Whether to disable ipv6 for this server block. |
|
string | localhost | The hostname of the server. |
|
string | -- | The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email. |
|
boolean | -- | Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set). |
Examples
Example 1
Nginx wordpress vhost config.
Code
- wordpress-vhost-nginx: vhost_name: my_wordpress_site wp_title: My wordpress site use_https: true host: dev.frkl.io base_path: /var/www/wordpress
Code
doc: short_help: Create Nginx wordpress virtual host config. examples: - title: Nginx wordpress vhost config. vars: vhost_name: my_wordpress_site wp_title: My wordpress site use_https: true host: dev.frkl.io base_path: /var/www/wordpress args: # vhost_name: # doc: # short_help: "The name of the vhost file." # required: false # type: string base_path: doc: short_help: The wordpress project folders parent directory. type: string required: false default: /var/www cli: show_default: true host: type: string default: localhost required: true doc: short_help: The hostname of the server. server_admin: type: string doc: short_help: The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email. required: false use_https: type: boolean required: false doc: short_help: Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set). cli: is_flag: true wp_title: doc: short_help: The name of the wordpress instance. type: string required: true cli: metavar: TITLE disable_ipv6: doc: short_help: Whether to disable ipv6 for this server block. type: boolean required: false default: false cli: is_flag: true param_decls: - --disable-ipv6 frecklets: # creating wordpress apache vhost - nginx-server-block-file: path: '/etc/nginx/sites-enabled/{{:: wp_title | clean_string | lower ::}}.conf' owner: root become: true index: - index.php server_names: - '{{:: host ::}}' use_https: '{{:: use_https ::}}' document_root: '{{:: base_path ::}}/{{:: wp_title | clean_string | lower ::}}' server_admin: '{{:: server_admin ::}}' disable_ipv6: '{{:: disable_ipv6 ::}}' upstream: - name: php properties: | server unix:/tmp/php-cgi.socket; server 127.0.0.1:9000; location_blocks: - location_match: /favicon.ico location_modifier: '=' properties: | log_not_found off; access_log off; - location_match: /robots.txt location_modifier: '=' properties: | allow all; log_not_found off; access_log off; - location_match: / properties: | try_files $uri $uri/ /index.php?$args; - location_match: \.php$ location_modifier: '~' properties: | #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi.conf; fastcgi_intercept_errors on; fastcgi_pass php; - location_match: \.(js|css|png|jpg|jpeg|gif|ico)$ location_modifier: ~* properties: | expires max; log_not_found off;
frecklecute wordpress-vhost-nginx --help Usage: frecklecute wordpress-vhost-nginx [OPTIONS] Create Nginx wordpress virtual host config. Options: --wp-title TITLE The name of the wordpress instance. [required] --base-path BASE_PATH The wordpress project folders parent directory. --disable-ipv6 Whether to disable ipv6 for this server block. --host HOST The hostname of the server. --server-admin SERVER_ADMIN The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email. --use-https / --no-use-https Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set). --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.wordpress_vhost_nginx.WordpressVhostNginx # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class WordpressVhostNginx(AutoPycklet): """Create Nginx wordpress virtual host config. Args: base_path: The wordpress project folders parent directory. disable_ipv6: Whether to disable ipv6 for this server block. host: The hostname of the server. server_admin: The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email. use_https: Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set). wp_title: The name of the wordpress instance. """ FRECKLET_ID = "wordpress-vhost-nginx" base_path: str = None disable_ipv6: bool = None host: str = None server_admin: str = None use_https: bool = None wp_title: str = None def __post_init__(self): super(WordpressVhostNginx, self).__init__(var_names=["base_path", "disable_ipv6", "host", "server_admin", "use_https", "wp_title"]) frecklet_class = WordpressVhostNginx
# -*- coding: utf-8 -*- # # module path: pycklets.wordpress_vhost_nginx.WordpressVhostNginx # from pyckles import AutoPycklet class WordpressVhostNginx(AutoPycklet): """Create Nginx wordpress virtual host config. Args: base_path: The wordpress project folders parent directory. disable_ipv6: Whether to disable ipv6 for this server block. host: The hostname of the server. server_admin: The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email. use_https: Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set). wp_title: The name of the wordpress instance. """ FRECKLET_ID = "wordpress-vhost-nginx" def __init__(self, base_path="/var/www", disable_ipv6=None, host="localhost", server_admin=None, use_https=None, wp_title=None): super(WordpressVhostNginx, self).__init__(var_names=["base_path", "disable_ipv6", "host", "server_admin", "use_https", "wp_title"]) self._base_path = base_path self._disable_ipv6 = disable_ipv6 self._host = host self._server_admin = server_admin self._use_https = use_https self._wp_title = wp_title @property def base_path(self): return self._base_path @base_path.setter def base_path(self, base_path): self._base_path = base_path @property def disable_ipv6(self): return self._disable_ipv6 @disable_ipv6.setter def disable_ipv6(self, disable_ipv6): self._disable_ipv6 = disable_ipv6 @property def host(self): return self._host @host.setter def host(self, host): self._host = host @property def server_admin(self): return self._server_admin @server_admin.setter def server_admin(self, server_admin): self._server_admin = server_admin @property def use_https(self): return self._use_https @use_https.setter def use_https(self, use_https): self._use_https = use_https @property def wp_title(self): return self._wp_title @wp_title.setter def wp_title(self, wp_title): self._wp_title = wp_title frecklet_class = WordpressVhostNginx