-
-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #428 from roots/nginx-config-improvements
Nginx role improvements: use more h5bp configs
- Loading branch information
Showing
7 changed files
with
44 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
nginx_path: /etc/nginx | ||
nginx_logs_root: /var/log/nginx | ||
nginx_user: www-data | ||
strip_www: true | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,63 @@ | ||
--- | ||
- name: Add Nginx PPA | ||
apt_repository: repo="ppa:nginx/stable" update_cache=yes | ||
apt_repository: | ||
repo: "ppa:nginx/stable" | ||
update_cache: yes | ||
|
||
- name: Install Nginx | ||
apt: name=nginx state=present force=yes | ||
apt: | ||
name: nginx | ||
state: present | ||
force: yes | ||
|
||
- name: Create SSL directory | ||
file: dest=/etc/nginx/ssl state=directory | ||
file: | ||
dest: "{{ nginx_path }}/ssl" | ||
state: directory | ||
|
||
- name: Generate strong unique Diffie-Hellman group. | ||
command: openssl dhparam -out dhparams.pem 2048 | ||
args: | ||
chdir: /etc/nginx/ssl/ | ||
creates: /etc/nginx/ssl/dhparams.pem | ||
chdir: "{{ nginx_path }}/ssl" | ||
creates: "{{ nginx_path }}/ssl/dhparams.pem" | ||
notify: reload nginx | ||
|
||
- name: Grab h5bp/server-configs-nginx | ||
git: repo="https://github.com/h5bp/server-configs-nginx.git" | ||
dest=/etc/nginx/h5bp-server-configs | ||
version=94b3680c9d13f108d6d62c22cba251b84f795aa8 | ||
force=yes | ||
git: | ||
repo: "https://github.com/h5bp/server-configs-nginx.git" | ||
dest: "{{ nginx_path }}/h5bp-server-configs" | ||
version: 82181a672a7c26f9bc8744fead80318d8a2520b1 | ||
force: yes | ||
|
||
- name: Move h5bp configs | ||
command: creates=/etc/nginx/h5bp/ cp -R /etc/nginx/h5bp-server-configs/h5bp /etc/nginx/h5bp | ||
|
||
- name: Copy conf files | ||
copy: src="{{ item }}" dest=/etc/nginx/{{ item | basename }} mode=644 | ||
with_fileglob: '*' | ||
command: cp -R {{ nginx_path }}/h5bp-server-configs/h5bp {{ nginx_path }}/h5bp | ||
args: | ||
creates: "{{ nginx_path }}/h5bp/" | ||
|
||
- name: Create nginx.conf | ||
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf | ||
template: | ||
src: nginx.conf.j2 | ||
dest: "{{ nginx_path }}/nginx.conf" | ||
notify: reload nginx | ||
|
||
- name: Disable default server | ||
file: path=/etc/nginx/sites-enabled/default state=absent | ||
file: | ||
path: "{{ nginx_path }}/sites-enabled/default" | ||
state: absent | ||
notify: reload nginx | ||
|
||
- name: Enable better default site to drop unknown requests | ||
command: creates=/etc/nginx/sites-enabled/no-default.conf cp /etc/nginx/h5bp-server-configs/sites-available/no-default /etc/nginx/sites-enabled/no-default.conf | ||
command: cp {{ nginx_path }}/h5bp-server-configs/sites-available/no-default {{ nginx_path }}/sites-enabled/no-default.conf | ||
args: | ||
creates: "{{ nginx_path }}/sites-enabled/no-default.conf" | ||
notify: reload nginx | ||
|
||
- name: Create base WordPress config | ||
template: src=wordpress.conf.j2 dest=/etc/nginx/wordpress.conf | ||
template: | ||
src: wordpress.conf.j2 | ||
dest: "{{ nginx_path }}/wordpress.conf" | ||
|
||
- name: Create base WordPress subdirectory Multisite config | ||
template: src=wordpress_multisite_subdirectories.conf.j2 dest=/etc/nginx/wordpress_multisite_subdirectories.conf | ||
template: | ||
src: wordpress_multisite_subdirectories.conf.j2 | ||
dest: "{{ nginx_path }}/wordpress_multisite_subdirectories.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters