Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
Fixed Nginx vhost include configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
neikei committed Oct 4, 2017
1 parent 8fa4ede commit fc5d78d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Feel free to report issues, fork this project and submit pull requests.

## Changelog

04 October 2017

- Fixed Nginx vhost include configuration

06 September 2017

- Changed Nginx installation source to the official repository
Expand Down
24 changes: 3 additions & 21 deletions ansible/roles/nginx/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
##################################################
### Special stuff to identify Vagrantboxes
- name: Check if Server is Vagrantbox
shell: 'grep vagrant /etc/passwd | wc -l'
check_mode: no
changed_when: false
register: vagrantbox

##################################################
### Install and configure webserver
- name: Add apt key for Debian
Expand All @@ -28,20 +20,10 @@
- { path: "/var/lib/nginx", mode: 777, user: vagrant, group: root }
- { path: "/var/lib/nginx/tmp", mode: 777, user: vagrant, group: root }

- name: Disable default virtual hosts file.
file:
path=/etc/nginx/sites-enabled/default
state=absent
notify:
- restart nginx

- name: Configure vagrant as nginx user
lineinfile:
- name: Copy nginx.conf
template:
src=nginx.conf
dest=/etc/nginx/nginx.conf
regexp='^user www-data'
line='user vagrant;'
backrefs=yes
when: vagrantbox.stdout != "0"

- name: Copy new virtual hosts file.
template:
Expand Down
32 changes: 32 additions & 0 deletions ansible/roles/nginx/templates/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
user vagrant;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ configs:
vmname: "symfony-development" # VM name for Virtualbox
servername: "lemp.test" # Servername and domain for your projects
projectnames: ["example"] # Comma-separated list with your projectnames
symfony_version: 3.3 # Symfony version like 3.3 or "lts"
symfony_version: 3.3 # Symfony version like 3.3 or "lts"

0 comments on commit fc5d78d

Please sign in to comment.