1##
2# mythweb configuration for nginx
3# - Requires php-fpm to handle php
4# - Requires fcgiwrap to handle perl
5#
6# please modify before use
7##
8
9server {
10	# If you want to run a non-SSL connection change this to 80
11	listen 443;
12
13	# Set up the document root to where mythweb is located
14	root /var/www/mythweb;
15	index index.html index.htm;
16
17	# Hostname of the server running mythweb
18	server_name localhost;
19
20	# If you want to run a non-SSL connection comment out this block
21	ssl_certificate certs/server.crt;
22	ssl_certificate_key certs/server.key;
23
24	# Configure this section for HTTP Basic Auth
25	location / {
26		auth_basic "MythWeb";
27		auth_basic_user_file mythweb.passwd;
28		index /var/www/mythweb/mythweb.php;
29		try_files $uri @handler;
30	}
31
32	# Sets up the pass-through to php-fpm
33	location ~ \.php {
34		include		fastcgi_params;
35		fastcgi_index   mythweb.php;
36		fastcgi_split_path_info ^(.+\.php)(/?.+)$;
37		fastcgi_param   SCRIPT_FILENAME	$document_root$fastcgi_script_name;
38		fastcgi_param   PATH_INFO $fastcgi_path_info;
39		fastcgi_param   db_server localhost;
40		fastcgi_param   db_name  mythconverg;
41		fastcgi_param   db_login mythtv;
42		fastcgi_param   db_password mythtv;
43		fastcgi_pass	unix:/var/run/php/php7.3-fpm.sock;
44	}
45
46	location ~ \.pl {
47		include		fastcgi_params;
48		fastcgi_param   db_server localhost;
49		fastcgi_param   db_name  mythconverg;
50		fastcgi_param   db_login mythtv;
51		fastcgi_param   db_password mythtv;
52		fastcgi_pass    unix:/var/run/fcgiwrap.socket;
53	}
54
55	# Required rewrite rules
56	location @handler {
57		rewrite /(.+\.(php|pl))/.*      /$1 last;
58		rewrite /(pl(/.*)?)$            /mythweb.pl/$1 last;
59		rewrite /(.+)$                  /mythweb.php/$1 last;
60		rewrite /(.*)$                  /mythweb.php last;
61	}
62}
63