Add working configuration of nginx to use uwsgi parameters without replacing entire file.
This commit is contained in:
parent
99bc5a4477
commit
703b322f23
|
@ -125,9 +125,6 @@ Internal Variables
|
|||
The following variables are part of the internals of the role. However if you really want to, you can tweak them to
|
||||
work with your setup:
|
||||
|
||||
- web_user:
|
||||
- The non-root user who is allowed to control web + app servers on the target machine.
|
||||
- Default: current user
|
||||
- virtualenv_root_path:
|
||||
- The common root directory of Python virtual environments associated with running the
|
||||
UWSGI app + server.
|
||||
|
|
|
@ -3,7 +3,3 @@
|
|||
- name: restart uwsgi app
|
||||
supervisorctl: name={{ uwsgi_app_service_name }} state=restarted config=/etc/supervisor/supervisord.conf
|
||||
sudo: yes
|
||||
|
||||
- name: restart nginx
|
||||
service: name=nginx state=restarted
|
||||
sudo: yes
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
# tasks file for ansible-nginx-uwsgi-supervisor
|
||||
- include: nginx.yaml
|
||||
- include: python.yaml
|
||||
- include: uwsgi.yaml
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
- name: install nginx webserver
|
||||
apt: pkg=nginx-full state=present
|
||||
sudo: yes
|
||||
|
||||
- name: configure nginx
|
||||
template: src=nginx/app_uwsgi_nginx.conf dest=/etc/nginx/sites-available/{{ nginx_app_config }}
|
||||
sudo: yes
|
||||
|
||||
- name: link to enable nginx configuration
|
||||
file: state=link
|
||||
src=/etc/nginx/sites-available/{{ nginx_app_config }}
|
||||
path=/etc/nginx/sites-enabled/{{ nginx_app_config }}
|
||||
sudo: yes
|
||||
|
||||
- name: disable default configuration
|
||||
file: state=absent path=/etc/nginx/sites-enabled/default
|
||||
sudo: yes
|
||||
notify: restart nginx
|
||||
|
||||
- name: set nginx directories permissions
|
||||
file: path={{ item }} state=directory
|
||||
group={{ web_server_group }} mode=0755
|
||||
with_items:
|
||||
- /var/log/nginx
|
||||
- /etc/nginx
|
||||
- /etc/nginx/sites-available
|
||||
- /etc/nginx/sites-enabled
|
||||
sudo: yes
|
||||
|
||||
- name: set nginx logs permissions
|
||||
file: path=/var/log/nginx/{{ item }} state=file
|
||||
owner={{ web_server_group }} group={{ web_server_group }} mode=0644
|
||||
with_items:
|
||||
- access.log
|
||||
- error.log
|
||||
sudo: yes
|
|
@ -4,5 +4,17 @@
|
|||
sudo: yes
|
||||
|
||||
- name: configure app on uwsgi server
|
||||
template: src=uwsgi/app_uwsgi.ini dest={{ uwsgi_config_path }}/{{ uwsgi_app_ini }}
|
||||
template: src=app_uwsgi.ini dest={{ uwsgi_config_path }}/{{ uwsgi_app_ini }}
|
||||
sudo: yes
|
||||
notify: restart uwsgi app
|
||||
|
||||
- name: configure nginx app with uwsgi specific block.
|
||||
blockinfile:
|
||||
dest: /etc/nginx/sites-available/{{ nginx_app_config }}
|
||||
insertafter: "# Include your setup to connect to the webapp setup here."
|
||||
marker: "# -- {mark} UWSGI App config for {{ app_name }} --"
|
||||
block: |
|
||||
include uwsgi_params;
|
||||
uwsgi_pass 127.0.0.1:{{ app_uwsgi_port }};
|
||||
sudo: yes
|
||||
notify: restart nginx
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
server {
|
||||
|
||||
server_name {{ app_nginx_hostname }};
|
||||
access_log {{ web_root_path }}/logs/nginx/{{ app_name }}-access.log;
|
||||
error_log {{ web_root_path }}/logs/nginx/{{ app_name }}-error.log info;
|
||||
|
||||
location /static/ {
|
||||
alias {{ app_nginx_static_path }};
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri @yourapplication;
|
||||
}
|
||||
location @yourapplication {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass 127.0.0.1:{{ app_uwsgi_port }};
|
||||
}
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
---
|
||||
# vars file for ansible-nginx-uwsgi-supervisor
|
||||
|
||||
# User
|
||||
web_user: "{{ ansible_env.SUDO_USER }}"
|
||||
|
||||
# NGINX
|
||||
nginx_app_config: "{{ app_name }}_uwsgi_nginx.conf"
|
||||
|
||||
|
||||
# UWSGI
|
||||
uwsgi_venv: "{{ virtualenv_root_path }}/uwsgi"
|
||||
uwsgi_config_path: "{{ web_root_path }}/config/uwsgi"
|
||||
|
|
Loading…
Reference in New Issue