Change nginx vhost template
This commit reduces the nginx vhost template to the bare minimum needed to get a vhost that can be used to get a certificate via letsencrypt's certbot.
This commit is contained in:
parent
4f396c606f
commit
de322b3442
2 changed files with 18 additions and 29 deletions
|
@ -77,10 +77,7 @@ def create_web_vhost_config(username, sitename, wildcard):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
conftmpl = _get_template('vhost.nginx')
|
conftmpl = _get_template('vhost.nginx')
|
||||||
confdata = conftmpl.render(
|
confdata = conftmpl.render(domain=sitename, wildcard=wildcard)
|
||||||
domain=sitename, user=username,
|
|
||||||
docroot=_build_document_root_path(sitename, username),
|
|
||||||
wildcard=wildcard)
|
|
||||||
conffile = None
|
conffile = None
|
||||||
try:
|
try:
|
||||||
nginxtemp, filename = mkstemp()
|
nginxtemp, filename = mkstemp()
|
||||||
|
|
|
@ -1,31 +1,23 @@
|
||||||
server {
|
server {
|
||||||
|
{% if wildcard -%}
|
||||||
|
server_name .{{ domain|parentdomain }};
|
||||||
|
{% else -%}
|
||||||
server_name {{ domain }};
|
server_name {{ domain }};
|
||||||
{%- if wildcard %}
|
|
||||||
server_name *.{{ domain|parentdomain }};
|
|
||||||
{% -endif %}
|
{% -endif %}
|
||||||
|
|
||||||
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
|
|
||||||
access_log /var/log/nginx/{{ domain }}.access.log;
|
access_log /var/log/nginx/{{ domain }}.access.log;
|
||||||
error_log /var/log/nginx/{{ domain }}.error.log;
|
error_log /var/log/nginx/{{ domain }}.error.log;
|
||||||
|
|
||||||
client_max_body_size 20M;
|
location /.well-known/acme-challenge {
|
||||||
gzip on;
|
root /srv/www/acme-challenge/{{ domain }};
|
||||||
gzip_types text/javascript application/x-javascript text/css;
|
|
||||||
|
|
||||||
root {{ docroot }};
|
|
||||||
|
|
||||||
index index.php index.html index.htm;
|
|
||||||
|
|
||||||
location ~ ^/(.+\.php)$ {
|
|
||||||
try_files $uri =404;
|
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-{{ user }}.sock;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ /\.ht {
|
location / {
|
||||||
deny all;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# vim: ft=nginx et sw=4 ts=4 si ai
|
||||||
|
|
Loading…
Reference in a new issue