do routing inside container
This commit is contained in:
parent
2fcdcb8586
commit
1062d3422a
@ -58,39 +58,16 @@
|
|||||||
- name: template nginx config
|
- name: template nginx config
|
||||||
copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
upstream index_php_upstream {
|
|
||||||
server {{ wordpress_container }}:8090; # NGINX Unit backend address for index.php with 'script' parameter
|
|
||||||
}
|
|
||||||
upstream direct_php_upstream {
|
|
||||||
server {{ wordpress_container }}:8091; # NGINX Unit backend address for generic PHP file handling
|
|
||||||
}
|
|
||||||
server {
|
server {
|
||||||
listen 80; # para debug
|
listen 80; # para debug
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name {{ wordpress_domain }};
|
server_name {{ wordpress_domain }};
|
||||||
|
|
||||||
# root /var/www/html;
|
|
||||||
# index index.php index.html;
|
|
||||||
# access_log /dev/stdout;
|
|
||||||
# error_log /dev/stdout info;
|
|
||||||
|
|
||||||
location {{ wordpress_web_root }} {
|
location {{ wordpress_web_root }} {
|
||||||
try_files $uri @index_php;
|
proxy_pass http://{{ wordpress_container }}:8080;
|
||||||
}
|
|
||||||
|
|
||||||
location @index_php {
|
|
||||||
proxy_pass http://index_php_upstream;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
}
|
|
||||||
|
|
||||||
location {{ wordpress_web_root }}/wp-admin {
|
|
||||||
index index.php;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~* .php$ {
|
|
||||||
try_files $uri =404;
|
|
||||||
proxy_pass http://direct_php_upstream;
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest: "{{ nginx_config_mountpoint }}/wordpress.conf"
|
dest: "{{ nginx_config_mountpoint }}/wordpress.conf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user