mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
06fc2d4c49
3 changed files with 43 additions and 4 deletions
16
roles/cups/tasks/nginx.yml
Normal file
16
roles/cups/tasks/nginx.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: Enable http://box/print via NGINX, by installing {{ nginx_conf_dir }}/cups.conf from template
|
||||
template:
|
||||
src: cups.conf
|
||||
dest: /etc/nginx/conf.d/cups.conf
|
||||
when: cups_enabled
|
||||
|
||||
- name: Disable http://box/print via NGINX, by removing {{ nginx_conf_dir }}/cups.conf
|
||||
file:
|
||||
path: /etc/nginx/conf.d/cups.conf
|
||||
state: absent
|
||||
when: not cups_enabled
|
||||
|
||||
- name: Restart 'nginx' systemd service
|
||||
systemd:
|
||||
name: nginx
|
||||
state: restarted
|
|
@ -1,2 +1,25 @@
|
|||
ProxyPass /cups http://localhost:631
|
||||
ProxyPassReverse /cups http://localhost:631
|
||||
location ~ /print/(.*) {
|
||||
proxy_pass http://127.0.0.1:631/$1;
|
||||
proxy_set_header Host '127.0.0.1';
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
sub_filter ' href="/' ' href="/print/';
|
||||
sub_filter ' action="/' ' action="/print/';
|
||||
sub_filter ' src="/' ' src="/print/';
|
||||
sub_filter_types *;
|
||||
sub_filter_once off;
|
||||
}
|
||||
|
||||
location ~ /cups/(.*) {
|
||||
proxy_pass http://127.0.0.1:631/$1;
|
||||
proxy_set_header Host '127.0.0.1';
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
sub_filter ' href="/' ' href="/cups/';
|
||||
sub_filter ' action="/' ' action="/cups/';
|
||||
sub_filter ' src="/' ' src="/cups/';
|
||||
sub_filter_types *;
|
||||
sub_filter_once off;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
ServerAlias *
|
||||
LogLevel warn
|
||||
MaxLogSize 1m
|
||||
Listen {{ lan_ip }}:631
|
||||
Listen localhost:631
|
||||
#Listen {{ lan_ip }}:631
|
||||
Listen 127.0.0.1:631
|
||||
Listen /var/run/cups/cups.sock
|
||||
Browsing On
|
||||
BrowseLocalProtocols dnssd
|
||||
|
|
Loading…
Add table
Reference in a new issue